07-18-2022 10:32 AM - edited 07-18-2022 10:36 AM
hi,
Im trying one equation in formula node but its showing error. The error is attached.
the equation is z=(500)/[(2^x)*(y+100)
thank you
Solved! Go to Solution.
07-18-2022 10:54 AM
Just wondering why you might need a formula node when you can achieve the same using LabVIEW primitives as shown below,
07-18-2022 10:56 AM - edited 07-18-2022 11:03 AM
What happens if you replace the "[]" with "()"?
(Still, I agree that there is not need for a formula node to do all this 😄 )
@newmemeber123 wrote:
The error is attached.
Next time, please attach your VI instead. It is impossible debug troubleshoot pictures.
07-18-2022 10:59 AM - edited 07-18-2022 11:07 AM
You cannot use a bracket ([ or ]) in a formula node. You need to use the parenthesis, which can be nested.
Just to be somewhat controversial, I sometimes prefer to use a formula node when math gets "weird". It just seems more natural to read to me. This is only when the math gets more complicated beyond a few nodes and variables are reused.
07-18-2022 11:06 AM - edited 07-18-2022 11:13 AM
@crossrulz wrote:
You cannot use a bracket ([ or ]) in a formula node.
Yes, you "can", but they have special meaning and are used for array indices, for example. 😄
@crossrulz wrote:
Just to be somewhat controversial, I sometimes prefer to use a formula node when math gets "weird". It just seems more natural to read to me. This is only when the math gets more complicated beyond a few nodes and variables are reused.
Except that a few minutes later, we need the same operation where the inputs/outputs are arrays. Graphical code will adapt automatically, while the formula node would need extra work. 😄
07-18-2022 11:08 AM
@altenbach wrote:
@crossrulz wrote:
You cannot use a bracket ([ or ]) in a formula node.
Yes, you "can", but they have special meaning and are used for array indices, for example. 😄
I knew I was going to get called out for that shortly after I hit "Post".
07-18-2022 11:29 AM
@newmemeber123 wrote:
Im trying one equation in formula node but its showing error. The error is attached.
The error description includes a hint:
Error on line 1 is marked by a '#' character: "z=(500)/[#(2**x).."
So LabVIEW tells you that there is a problem with the bracket.
07-18-2022 11:43 AM
@ThomasHenkel wrote:
So LabVIEW tells you that there is a problem with the bracket.
One of the reasons I don't use the formula node is that the error messages are so cryptic.
Here, the problem is not with a "missing semicolon" as described and it is never really obvious (at least to me) if the "#" is to the right or left of the problem. 😄
07-18-2022 11:48 AM
@altenbach wrote:
and it is never really obvious (at least to me) if the "#" is to the right or left of the problem.
I'm 98% sure, the '#' is always after the character that caused the error 😉
07-18-2022 12:02 PM
@ThomasHenkel wrote:
@altenbach wrote:
and it is never really obvious (at least to me) if the "#" is to the right or left of the problem.I'm 98% sure, the '#' is always after the character that caused the error 😉
Yes, after successfully correcting many errors we learn from experience that that's true!
The statement "Error on line 1 marked by a '#' character" is just not concise enough.
If I were the compiler, I would probably place the # before the problem, delineating the border between good and bad code , i.e. "OK, I was able to successfully parse up to here, but I stumbled going forward". 😄
Good thing we have a graphical code alternative. 🙂