From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-29-2004 07:17 AM
10-29-2004 07:29 AM
10-29-2004 08:01 AM
10-29-2004 08:01 AM
10-29-2004 08:08 AM
10-29-2004 08:34 AM
05-25-2011 04:20 PM
Regarding the values used to define a given case structure, e.g. 0..10 for case 1 and 10..20 for case etc... can the values 0, 10, 20 etc. be input to the case structure through a numeric control? In other words, if I want to use the values of the various case structures as parameters which will be varied each time I use the vi, how would I configure that?
Right now, I can see only that the case structures are "hard wired" with the values used as limits.
Suppose case 1 is for 1<x<10
Suppose case 2 is for 10<x<20
Suppose case 3 is for 20<x<30
Now, suppose that I want to vary the values 1, 10, 20 and 30 to 3, 12, 22, and 32 etc. Can I have a numeric control for each of the case structure values, instead of opening and editing the block diagram each time we want to vary these values?
Thanks,
Dave
05-25-2011 05:01 PM
No. You can't programmatically change the case structure conditions.
What I would do is make the comparisons and output a boolean for each comparison. Build the boolean values into and array, and use Boolean Array to U8. Feed that value to a case structure.
Now if the first condition is true, it will run the case called 1.
If the second condition is true, it will run the case called 2.
If the third condition is true, it will run the case called 4.
A fourth condition would run case 8.
Make the original case a 0; default which does nothing if no conditions or true, or if you come up with some situation where multiple conditions are true (which should happend if the conditions are formed correctly.)
05-25-2011 07:02 PM
I am still a little confused. If you make each comparison have a Boolean output, then, won't the array be a list of 0's and 1's or T and F? If there are only two unique values in the array, then, how does the case structure provide more than 2 actions? What am I missing?
05-25-2011 10:33 PM
You are missing the conversion of the boolean array to a number. So you now have essentially a binary number that uniquely identifies a combination of conditions.
See attached