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 or problem

Hi,

 

I'm having a problem using the formula node.

The output variable is always 1, but I notice that if the code was:

 

if(N != 1)
L = 1;
else
L = 0;

 

The program work ok.

 

Thanks,

Sílvia

Download All
0 Kudos
Message 1 of 4
(3,629 Views)

Your screen shot shows if(N!=1||N!=2).  That is if N is not equal to 1 OR N is not equal to 2.  Well, since N can never be equal to 1 and 2 at the same time, of course the statemenet always evaluates to True.

 

If N=0  True OR True = True

If N=1  False OR True = True

If N=2  True OR False = True

If N=3  True OR True = True

 

0 Kudos
Message 2 of 4
(3,623 Views)

Silvia,

you must inver the logic because... N is always different from 1 OR different from 2

Try with:

 

if ( N == 1 || N == 2)
L=0;
else
L=1;

 

Cheers

0 Kudos
Message 3 of 4
(3,617 Views)

Thanks,

 

I verify it after...

 

0 Kudos
Message 4 of 4
(3,611 Views)