LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to Create Command if in labview , how can I do that

how can I create command if in labview

for example :
if A==350 THEN pass]
if a==90 then fail
else exit

how can I do this
0 Kudos
Message 1 of 8
(2,570 Views)
Use a case structure. Wire "A" to the input selector and make three cases. Make the first case 350 and put your pass condition in it, then make the second 90 and put your fail condition in it. In the third case make it 0 and also make it the default case. See attached.

Brian
0 Kudos
Message 2 of 8
(2,570 Views)
Hi
first thank you

but if I want to write

if a=0.09 then pass
if a= 0.350 then fail
else exit

how can I do that
0 Kudos
Message 3 of 8
(2,570 Views)
Convert the number to a string and wire the string to the case statement.
0 Kudos
Message 4 of 8
(2,570 Views)
Good point...
0 Kudos
Message 6 of 8
(2,570 Views)
There is a couple ways that I can think about to do this. One would be to use a formula node where you can write the conditions like you have. Or you can use the "Equals" function to check the value. See the attached modified version of the example to see a couple of ways of doing this.

Brian
0 Kudos
Message 5 of 8
(2,570 Views)
A note of caution. As discussed in an earlier thread, it is never a good idea to make an equal to comparison on floating point numbers.
0 Kudos
Message 7 of 8
(2,570 Views)
Yeah I remembered that right after I posted, the string method would be much more reliable. I don't usually need to worry about the specific value of a floating point number, just if its in a range. So I forget about these things.

Thanks for the clarification!

Brian
0 Kudos
Message 8 of 8
(2,570 Views)