05-25-2017 05:52 AM
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
Solved! Go to Solution.
05-25-2017 06:36 AM - edited 05-25-2017 06:37 AM
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.
05-25-2017 06:40 AM
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
05-25-2017 07:26 AM
Hi crossrulz,
this is amazing and much better than the way i thought I about it.
thanks for answering my question.
amazing
05-25-2017 07:27 AM