LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure greater than or less than

Solved!
Go to solution

Hello.

 

I am having difficulty with making a case structure that if a numerical input is greater than a number it does one thing and less it does another.

 

Basically how do you work with case structures that aren't boolean, specifically if a number is greater than 38 it reassigns it as 0 (multiplies by zero something like that).

0 Kudos
Message 1 of 6
(15,328 Views)
Solution
Accepted by Neil_Helsel

@Neil_Helsel wrote:

Hello.

 

I am having difficulty with making a case structure that if a numerical input is greater than a number it does one thing and less it does another.

 

Basically how do you work with case structures that aren't boolean, specifically if a number is greater than 38 it reassigns it as 0 (multiplies by zero something like that).


You can use range in a case structure selector field. Use 38.. for greater than or equal to 38, ..38 for less than or equal to 38. You need to use integers for this.

 

EDIT you can also use the greater than operator if you just have 2 possibilities.

 

Ben64

Message 2 of 6
(15,312 Views)

You can type "..38" in the case structure text which mathematically means ]-inf,38]

case.png

0 Kudos
Message 3 of 6
(15,309 Views)

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/case_selector_values/

 

Or use the boolean logic you are talking about.  If you use a greater than on your number and it is greater you will get a true and if it is not greater than it will be false.  You could even use the in range function (comparison pallete) to get a true or false.

 

Or give more information about what you are trying to do.  The more info you give, the better answer you will get.  Otherwise we have to guess why you are trying to do it the way you are asking when there could be a better way.

0 Kudos
Message 4 of 6
(15,296 Views)

Use an Integer connected to the case selector. You must have a default case and values such as   36 ...  or    0.. 35 and -1, as default.  would be less than 0 is default, 0-35 is a case and 36 and greater is a case.

0 Kudos
Message 5 of 6
(15,285 Views)

This is definitely the better way to do whatever it is you want to do.  Even though you said no boolean.

Example.JPG

0 Kudos
Message 6 of 6
(15,281 Views)