LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a case structure with values strictly greater than a number

Solved!
Go to solution

I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10. 

0 Kudos
Message 1 of 11
(275 Views)
Solution
Accepted by topic author ef99

Case structure works with integer numbers, so it will be 11.. (11 and above).

PS edit: If it has 2 cases, I prefer to have comparison outside. It is easier to modify threshold, works with floats and I can see that there are no other cases without clicking - readability!

Message 2 of 11
(260 Views)

The case structure operates strictly on integer ranges. 

Greater than 10 would be "11.."

Less than or equal to 10 would be "..10"

Did you read the help file? 

aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 3 of 11
(253 Views)

You could simply use a (>10) comparison with a true/false case structure.

 

Ben64

--------------------------------------------------
The best way to say thanks is to give kudos!
Message 4 of 11
(246 Views)

@Alexander_Sobolev wrote:

Case structure works with integer numbers, so it will be 11.. (11 and above).

PS edit: If it has 2 cases, I prefer to have comparison outside. It is easier to modify threshold, works with floats and I can see that there are no other cases without clicking - readability!


And, if a case structure is driven by a simple boolean decision.... why not use "Select?"

 

There are cases when a boolean driven case structure is prefered.  That odd case is not normally used appropriately, and often leads to code that might get referred to on the famous Rube-Goldberg thread.

0 Kudos
Message 5 of 11
(220 Views)

@ef99 wrote:

I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10. 


I agree with Ben that all you need is a simple comparison resulting in a boolean if the input is a floating point number. Of course of you are dealing with integers, all you need is two cases ( "..10" | "11..") and you are all set.

 

A case structure switches between alternative code paths and does not display any messages. Most likely you don't even need a case structure. Here's one possible code skeleton. Modify as needed.

 

CompMessage.png


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 6 of 11
(217 Views)

@altenbach wrote:

@ef99 wrote:

I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10. 


I agree with Ben that all you need is a simple comparison resulting in a boolean if the input is a floating point number. Of course of you are dealing with integers, all you need is two cases ( "..10" | "11..") and you are all set.

 

A case structure switches between alternative code paths and does not display any messages. Most likely you don't even need a case structure. Here's one possible code skeleton. Modify as needed.

 

CompMessage.png


Did you mean pick line? There is no need for that blue wireSmiley Very Happy

0 Kudos
Message 7 of 11
(202 Views)

@JÞB wrote:

Did you mean pick line? There is no need for that blue wireSmiley Very Happy

It's an array, not a multiline string. Yes, pick line would work too but would also require a blue wire. Maybe you were thinking about append true/false string instead?

 

Sometimes it helps if the actual values are spelled out, so here's yet another way:

 

CompMessage2.png


LabVIEW Champion Do more with less code and in less time
Message 8 of 11
(181 Views)

@altenbach wrote:

@JÞB wrote:

Did you mean pick line? There is no need for that blue wireSmiley Very Happy

It's an array, not a multiline string. Yes, pick line would work too but would also require a blue wire. Maybe you were thinking about append true/false string instead?

 

Sometimes it helps if the actual values are spelled out, so here's yet another way:

 

CompMessage2.png


I actually have the day off and am posting via phone.   Yes I was thinking about append true false string....

 

Select is nicer looking!

0 Kudos
Message 9 of 11
(176 Views)

@JÞB wrote:

@altenbach wrote:

@ef99 wrote:

I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10. 


I agree with Ben that all you need is a simple comparison resulting in a boolean if the input is a floating point number. Of course of you are dealing with integers, all you need is two cases ( "..10" | "11..") and you are all set.

 

A case structure switches between alternative code paths and does not display any messages. Most likely you don't even need a case structure. Here's one possible code skeleton. Modify as needed.

 

CompMessage.png


Did you mean pick line? There is no need for that blue wireSmiley Very Happy


You can also use native string functions. (Pick line stills needs the blue wire)

 

Snap24.png

 

mcduff

Message 10 of 11
(173 Views)