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: 

how to compare lots of values

hello master , can you give me advice , im confuse how to create program comparison , below is little piece from the formula that im trying to fix 

 

=IF(x>=3;10;IF(x>=2;20;IF(x>=1;30;IF(x<1;40))))

x = input number , 

 

any advice or code will help me thanks

0 Kudos
Message 1 of 6
(2,680 Views)

Hi kucink,

 

use a case structure with 4 cases…

(When x is a float datatype you should round to integer first.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,662 Views)

Hi kucink,

 

As GerdW explained, one option is the Case Structure and wiring x to your selector.

Another option that might map more closely to your input statement is the Select node, which you could create a series of.

 

A discussion of "if" in LabVIEW can be found here: The LabVIEW Equivalent of an If Statement


GCentral
Message 3 of 6
(2,644 Views)

Hi kucink,

 

no case structure/select node needed:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(2,627 Views)

finaly i can solve it , thanks for help guys Smiley Happy

0 Kudos
Message 5 of 6
(2,577 Views)

Glad you solved it, but that file doesn't look like it has anything to do with the solution 🙂


GCentral
Message 6 of 6
(2,562 Views)