LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare between the numeric upper limit and the lower one, display string result

Solved!
Go to solution

Hi Everyone, 

 

I'm trying to compare a result of my program depends on one variable input, with fixed numbers as limits. 

 

i have an X variable number, the lower limit to this X is 1, and the upper limit is 23

 

i'm trying to make a simple program to check the result and display a message according to the number of X

 

the structure as the following

 

if X is less than or equal 12, then display "High"

if X is greater than 12 and less than or equal 14, then display "Moderate" (number 13 and 14 only)

if X is greater than 14 and less than or equal 16, then display "Mild" (number 15 and 16 only)

if X is greater than 16 and less than or equal 23, then display "Low". 

 

I tried to look at the internet and check how the Formula node works, but i haven't found any sanctification answer. and I couldn't make it through the formula.

 

so I used (In Range and Coerce) function to make this program runs in a good way. 

 

however, I build a case structure with 4 cases after the default

0 the default one which is high

1 is the high case

2 is the moderate case

3 is the mild case

4 is the low case. 

 

my program works correctly with both 1 and 2, but when it came to the Mild case and Low case, it doesn't process in correct way. 

 

the VI attached is V2016

the picture display exactly my block diagram

 

 

any help please. 

 

 

 

 

Thanks already 

0 Kudos
Message 1 of 5
(3,194 Views)
Solution
Accepted by topic author N.Ghrayeb

I recommend a different approach.  Something a lot more scalable.  Use arrays as a lookup.  You can use Threshold 1D Array and Round To +Inf in order to get the index of your string array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
(3,164 Views)
Solution
Accepted by topic author N.Ghrayeb

Hi Ghrayeb

 

I have attached an example in LV 2014. Bear in mind this VI does not repson to values beyond 23 though it can easily be modified.

 

Hope this helps.

 

Ingram

Ingram | CLA
0 Kudos
Message 3 of 5
(3,161 Views)

Hi 

 

 

 

 

 

 

0 Kudos
Message 4 of 5
(3,150 Views)

Hi ingram.weeks

 

that a beautiful approach. definitely an answer for my question. 

 

 

 

 

cheers, 

0 Kudos
Message 5 of 5
(3,149 Views)