LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula Operators

Hi, I'm using the Parse Formula Node.vi and Eval Parsed Formula Node.vi to evaluate just basic equations, but I'd like to use them to evaluate operators such as >, <, =, etc. I get an error when my formula includes any of those operators. Any suggestions? Thanks.
0 Kudos
Message 1 of 7
(3,691 Views)
You cannot perform comparison operations with those VIs. For that you need to use the Formula Node. This is in the LabVIEW documentation.
0 Kudos
Message 2 of 7
(3,683 Views)
I had a program where I wanted to have a user-input formula that would use complex numbers. Unfortunately the formula evaluation vis don't support complex numbers. So I modified them. I needed to insert a new function which I called "ii". I modified "Function Decomposition.vi" so that it would recognize "ii" as a function and asign it a number. Then I modified "Three Register Calculation.vi" to add a new case for my new function. And then there were a few more fixes to get it to work correctly that I can't remember right now.
0 Kudos
Message 3 of 7
(3,670 Views)
Hmm. I don't think the Formula Node will let me have a variable formula for the user to enter.
0 Kudos
Message 4 of 7
(3,658 Views)
As far as I know the formula node does NOT have inputs to change the formula itself. In my earlier post I was refering to "Advanced Forumla Parsing" functions (Analize->Mathematics->Formulas). The only use I have for these are for user input formulas or formulas that change. They seem to run fairly slowly. And I don't think they can do multiple line formulas.
0 Kudos
Message 5 of 7
(3,654 Views)
Sima: I did not mean to imply that the Formula Node will allow you to create a user-defined formula. You can't. All I was saying is that comparison operations cannot be done with the VIs that you were trying to use, and this was in the LabVIEW documentation. The "Eval" functions in the Analyze->Mathematics->Formula section allow you to have variable formulas, but based on the documentation none of these VIs handle comparison functions. For what you're doing you will probably need to code up your own parser. Over the years I've seen various types of formula parsers, so perhaps if you did a web search you might be able to turn something up.

You didn't say how critical being able to do this is to your application. An alternate (though admittedly clumsy) solution may be to use the Matlab or Mathscript node. You can write out your function to a file and then have the Matlab/Mathscript node call the function. You can check the Matlab/Mathscript documentation on this, or just head over to the MathScript forum.


0 Kudos
Message 6 of 7
(3,636 Views)
Thanks for the replies. I can't say it's a life or death situation, but it would be really really nice to have 🙂 It would make certain things easier.
0 Kudos
Message 7 of 7
(3,630 Views)