LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formula Node (Numeric Comparision by using AND, OR functions)

Dear All,
 
I want to compare my input if it is in the range of/between 0.00 and 0.5 it should return/output 0.5, how i can do this in Formula Node.
 
 
e.g
 
If (x>=0 and X<=0.5)
y=05;
if (x>0.5 and x<=1)
y=1;
if (x>1  and x<=2)
y=2;
 
0 Kudos
Message 1 of 3
(2,325 Views)
Hello M.
As long as your logic does not get much longer I would recommend a conditional evaluation like

y =
(x>=0.0 && x<=0.5) ? 0.5 :
(x>0.5 && x<=1.0) ? 1.0 :
(x>1.0 && x<=2.0) ? 2.0 : -1;

I hope you like it, Guenter
0 Kudos
Message 2 of 3
(2,318 Views)
Thanks Guenter,
 
Its first time that i Got so accurate response from NI. But only thing that i want to know was how i can use OR function like AND (&&) you already explained in a well maner.
0 Kudos
Message 3 of 3
(2,303 Views)