LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple boolean to number value for Case structure

What I would like to do here is be able to select case 1 if Deck A boolean is pressed and case 2
if Deck B boolean is pressed. I know that this can be done by making more case structures around the
boolean output of each Deck A and Deck B boolean selectors and then if either is true than an inputted
value constant such as 1 or 2 is released in the True case of each (respectively (see example below) then
I am stuck trying to get these values both into the Case selector. How do I do this? Also I don't want to have
to use Case selectors like this, (I will have them all over the place in my VI or Sub VI's then. I could also use the
+1 to one of the Boolean values after it is converted ot a number 0
or 1. Is there some way to create an array
or string or something that will connect to this case structure that will only give appropriate values when each
respective Boolean is pressed? Maybe I should use a different structure like an event or something but am not sure how to go about doing this. Thanks for any help.

CalTech
0 Kudos
Message 1 of 3
(4,344 Views)
Hello,
Indeed, you could program this using an event structure, and there are also many other ways to program it. If you want to keep away from the trickiness of programming with event structures, a possible solution is the one I show in the attached VI, which is in LabVIEW version 7.0 (I hope you can open it; if not, I am also attaching an image). What I do there is create an array of the boolean buttons, then use the search 1d array function to search for a "true" value. If it is found, then the corresponding case of the case structure is executed. I think this is what you need, but let me know if it isn't.
Download All
Message 2 of 3
(4,342 Views)
Wow, great thread. I have been trying to figure out how to do this with even structures forever... soo much easier this way 🙂
0 Kudos
Message 3 of 3
(4,122 Views)