From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble mapping integer value to boolean array.

Hello - I'm a VB.net guy trying like hell to get the hang of labview and I am stumped 😞

 

I have an boolean array which represents 7 led indicators. My piece of equipment (which is older than I am) gives a status byte and I am only interested in bits 0-2. The possible values are (000, 001, 010, 011, 100, 101, 110) or ( 0-6 depending on how you want to look at it) each one of these needs to be mapped to an led. So if the status is "5" I only want the 5th led to go true.

 

In vb.net I would just quickly type up 7 cases and be done. In labview I'm confused on if that would be the correct approach. It just seems tedious to have to make a seperate array buried in a select case structure 7 times. I must be missing something.

 

-Chris

 

 

0 Kudos
Message 1 of 7
(5,708 Views)

Seven cases? whoah VB is overachieving:

 

I left the labels of the functions on, so you can easily find them.

 

Ton

Message Edited by TonP on 08-29-2008 09:19 PM
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 2 of 7
(5,700 Views)

Sorry I reread your post and it seems like you want to highlight the led# of the actual value, instead of the bit representation:

Here goes try 2:

 

 

Ton

 

Message Edited by TonP on 08-29-2008 09:24 PM
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 3 of 7
(5,698 Views)

THANKS!

 

Works perfect; I had a feeling I needed to use the replace array function but just couldn't get it to work. Of course it now seems so obvious. Thanks again.

0 Kudos
Message 4 of 7
(5,691 Views)

Here is an alternate solution:

 

If you want the output array to be only 6 elements then just use a Split 1D Array function. 

Message Edited by smercurio_fc on 08-29-2008 03:50 PM
0 Kudos
Message 5 of 7
(5,674 Views)

smercurio_fc wrote:

If you want the output array to be only 6 elements then just use a Split 1D Array array subset function. 


Fixed it for you. 😄

0 Kudos
Message 6 of 7
(5,669 Views)

altenbach wrote:

smercurio_fc wrote:

If you want the output array to be only 6 elements then just use a Split 1D Array array subset function. 


Fixed it for you. 😄


Oh yeah, forgot about that thread. Smiley Very Happy

 

I don't have 8.6 but it would be interesting to run those benchmarks under 8.6 to see if there was any change and to update that thread.  

0 Kudos
Message 7 of 7
(5,666 Views)