03-16-2011 04:38 PM
I have a one dimensional array of numbers (integers) that run from 200 to 400.
If the numbers fall between 200 to 378, I want it to execute a certain case.
If the numbers are greater than 378 I want it to execute the other case.
How do I do this?
simple enough but its late and I'm stumped.
Thanks
mhaque
03-16-2011 05:06 PM
03-16-2011 05:06 PM
Your description is insufficient to give a solution:
03-16-2011 10:58 PM
If i have understood the question properly this is what you are looking in to
03-17-2011 01:20 PM
If the number is less than or equal to 378 I want it to execute the default case.
If the number is more than 378 I want it to execute the other case.
Ans1) Do you mean each element in the array?
Ans2) No, I want it to excute all the values.
Thanks for all your help.
I have tried to explain to the best of my ability please let me know if you need further clarification.
03-17-2011 01:47 PM
you're only looking for the FIRST true in the array? What about all the others values in the array.
If you want to check every value in the array, you will have to use somekind of a loop.
If you're just looking for an edge (with 378 as level) then you've found the edge.
If you really want to test every value :
I would pass the array through a FOR loop and decide which case to execute :
03-17-2011 01:51 PM
Could you explain further as to why I need some kind of a loop?
Essentially I want a numeric indicator coming out of the case structure and not an array of values.
Thanks
Mahir
03-17-2011 01:55 PM
ok, you've got an array of values. That is a list of values.
Every value in this list can be higher or lower then 378? Not?
If not, how do you want to decide which value you want to use for the test? The maximum from the array?
03-17-2011 02:18 PM
I've donw what you have told me but I'm getting this error
"A Case structure must have a case corresponding to every possible value of the selector. An easy way to fill this requirement is to specify a default case or cases whose selector values include ranges to or from infinity."
How should I label the case strcuture?
Will the output array be a 1D array of 2 elements only? 1 corresponding to each case?
thanks
mhaque
03-17-2011 02:22 PM
You forgot the default case.
Right click on a case and set it as default. (look at attachement)
What my VI will do is, it will test every value in your array and select a case for it and outputs that value. So your output array will have just as many items as your input array.