08-03-2005 08:02 AM
08-03-2005 02:24 PM
06-07-2011 02:17 AM
As a followup to what Ryan wrote. If you manage to do a search & replace "preprocessing" of the formula string, you can use the following expressions to make x=min(a,b) and y=max(a,b) because the sign-function is allowed in the Eval formula node.
x = b*(sign(a-b)+1)/2 + a*(sign(b-a)+1)/2;
y = a*(sign(a-b)+1)/2 + b*(sign(b-a)+1)/2;
There are probably other ways to do it, requiring fewer operations or simpler to read, but this is what I could think of when I faced the same problem. It can be altered to emulate many relational operators and the "condition ? when_true : when_false" construct. Haven't actually made the string preprocessing though.
06-07-2011 02:23 AM
Hi Erik,
I think you didn't see the date of this post..:) anyway, good job..kudos to u..;)
Regards,
Nitzz
06-25-2013 05:33 PM
As another followup, many years later, the Parse Formula Node and Eval Parsed Formula Node pair still doesn't support Min, Max, and a few other functions, nor Boolean logic. According to Rolf Kalbermatter (Hi, Rolf), there are other issues with these old VIs. Maybe the MathScript node is the way to go now, as long as you want to install MatLab. Has anyone updated the Formula VIs, or come up with any other way to allow RUN-TIME editing of a formula, maybe scripting a formula node, or other clever tricks? I didn't find anything on OpenG.
06-26-2013 05:12 AM
@MegKB wrote:
Maybe the MathScript node is the way to go now, as long as you want to install MatLab.
The MathScript node does NOT need Matlab. It runs Matlab-like code, but it is totally inside of LabVIEW. There is a Matlab node that uses ActiveX to run Matlab. For that you need to have Matlab installed.