LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean cluster to channel index number

Hello,

 

I have a cluster with 5 boolean values representing different channels. I'm trying to make it so that if the 3rd and 5th toggles are switched, it would output a csv string array with ch3 and ch5. I'd apprecieate it if someone can help and give some suggestions, I've looked on the forum but couldnt figure it out.

 

Thanks

0 Kudos
Message 1 of 4
(2,852 Views)

Hey MaxXx,

 

I see what you're trying to do here, unfortunately the Boolean Array to Numeric that you are using will get an integer from the entire array, not based on which of the vales are selected.  I think the best way to go would be to iterate through each element in the cluster and concatenate a string each time that element is true.  I went ahead and made a quick little VI that does exactly that.  See if this is more what you are looking for.  

 

 

Regards,

Eric L.
Applications Engineering Specialist
National Instruments
Message 2 of 4
(2,842 Views)

Here's one option.  If you know that the booleans in the cluster will always be named in numeric order, you could skip the Variant functions and convert the for loop's the iteration count [i] terminal to a string.  This image is a "snippet" - you can drag it directly to a block diagram (depending on your browser, you may need to drag it to the desktop first, and from there to the block diagram).

bool cluster to csv string list.png

0 Kudos
Message 3 of 4
(2,841 Views)

Thank you very much. Both solutions works well. I have attached the final version here that will create a channel list using 80 toggles that can be used with dmm or switch VI's if anyone look for it in the future.

 

Thanks again for the help!

0 Kudos
Message 4 of 4
(2,835 Views)