LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with mod(x,y) in Eval y=f(x) VI

Solved!
Go to solution

I can't seem to get mod to work in the Eval y=f(x) VI.  I entered "mod(x,20)" for a formula and get error -23001 "Syntax error of parser".  If I instead use "x-20*floor(x/20)" which should be the exact same thing, it works - no error.  Any idea what I'm doing wrong with mod?

0 Kudos
Message 1 of 3
(3,043 Views)
Solution
Accepted by topic author gharris

That function is not supported in the Formula Evaluation VIs.  In fact, no function of two variables is supported.  My usual workaround in similar cases is to use a little regex voodoo, in this case to replace the mod expression by its longhand equivalent.

 

EvalModFunction.png

 

You could also modify the Eval VIs to add the '%' function, which I did for the heck of it, but it is a jungle in there.

 

 

 

 

Message 2 of 3
(3,033 Views)

aah - that explains it.  Thanks, and nice string parsing!

0 Kudos
Message 3 of 3
(3,006 Views)