12-21-2011 12:18 PM
Using the formula evaluation VIs, you can setup a way for the user to enter the formula of his or her choice and calculate the result based on what the values are. The limitation is that these VIs don't support boolean operations like the formula node does or like manually coding the formula with a bunch of ANDs and ORs. If only the formula node could accept a formula to be entered at run-time.
Does anyone know of a way that will allow users to enter formulas with boolean operations, such as y = a & b, that will perform a bitwise AND, for example?
Thanks.
12-21-2011 02:52 PM
Looks like there may be hope using VI scripting. Has anyone used VI scripting to modify a formula node before? Trying to mess with that now...
12-21-2011 10:27 PM - edited 12-21-2011 10:35 PM
I figure there has to be a way to get to a formula node by way of scripting. So I started playing around.
See this.
Now this is just a VI that is basically operating on itself and shows the classes and properties do exist.
I think for your situation, you would need to dynamically create a new subVI. Run scripting code to generate a formula node, the inputs and output node to the formula, controls and indicators to link to those nodes along with the wiring connections. Then place the formula expression into the formula. Then dynamically call the VI (may need to save it first) to send it your values and return the output.
It seems like it would be a lot of work, but certainly doable.
12-22-2011 07:02 AM
At run time, it might be easier to use things like the formula waveform vi.
12-22-2011 08:24 AM
12-22-2011 09:44 AM - edited 12-22-2011 09:45 AM
It would seem a basic RPN calculator would be doable as well. Effectively create the parser itself. It isn't that difficult to do actually. Using the Scan String For Tokens VI would make this a pretty basic parser.