ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula Node variable assignment problems

I have a formula node with the follwing:
Inputs:E,X,T,PD,I
Outputs:PK,PD

The statement inside the formula node is:
if (Eelse if (PD=1) if (E else if (E<=X) ;
else PK=I, PD=1;

The logic seems to be working the way I want, the problem is in the last else statement. PK is never assigned the value of I. however, PD is assigned the value of 1. There are no errors indicated.

The source of the I input is the iteration # of the For loop where this formula node is located.

Anyone see what I am missing??

Thanks,

Mike
0 Kudos
Message 1 of 3
(2,860 Views)
Mike,

In comparisons, == should be used instead of =. This is a very common mistake, and a reason that forumla nodes should be avoided if possible (except of course for very long formulae that would require a lot of nodes.

It looks like your code would be better represented with LabVIEW nodes instead of in a formula node (for readability - there is no performance difference.)

Also, you may wish to reconsider using an Input variable that has the same name as an output variable. Try using PDi and PDo, or PD1 and PD2 instead.

Good luck.
Message 2 of 3
(2,860 Views)
Thank you again for your help.
The = in the comparison seems to have been the problem.

Mike
0 Kudos
Message 3 of 3
(2,860 Views)