LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of Booleans

Is there a way to know which toggle switches were selected on a frt panel with 6 or so  Sws.  The sw's select a particular test.  I saw an example in the discussion grp to find out which SINGLE element in the boolean array was high ( use Build an array then search 1 d array) .  What if I have 2 or 3 or 4 etc that were selected.  How can I tell boolean sw associated w "turn on pwr suppl1 and Turn on PS 2 " was selected?

 

Thanks,

 

Clint

0 Kudos
Message 1 of 7
(3,692 Views)

The way I would do this usually is through the event structure, but you can use a shift register and check equality between itterations as well.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 7
(3,689 Views)
Convert the boolean array to a number.  If the first and third switch are on, your result will be five.
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 7
(3,685 Views)

Hey Clint,

 

Paul and Jim have some good suggestions. I agree with Jim though, creating a Boolean array and converting it to a number is a clean way to do what you are attempting to do. I have created a small example that shows how to do this in LabVIEW 8.6. I have also included a picture of the block diagram, in case you have a different version of LabVIEW.

 

Let us know if this helps.

 

Ben

Applications Engineering

National Instruments

Hope this helps.
-Ben

WaterlooLabs
Download All
0 Kudos
Message 4 of 7
(3,648 Views)

XOR old and new values. Everything True has changed.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 7
(3,638 Views)

Another approach would make the array of booleans a cluster of booleans with an appropriate name for each.

 

Then set up an event for each boolean. The events will be serviced in the order the buttons are clicked.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 7
(3,631 Views)

Thanks everyone.

I played w Event Structure (ES) and I think I got that to work.  I worked off of an example from the Discussion Grps posted back in 2006.  When I 1st posted I didn't think you could get an ES know  which toggle SW "Changed Value".  I thought it only let you know a toggle sw ( Boolean) chg'd.   It does, and the chg value is perfect for what I want to do.

 

Again, Thanks.

0 Kudos
Message 7 of 7
(3,593 Views)