LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fast boolean array to number array conversion

Solved!
Go to solution

Hi,

Can anyone tell me the fastest way to convert a boolean array to an array of numbers repressenting 8bit words?

Examples:

1D Boolean array: 11001001 11111111 10110010

1D U8 Output:  201 255 178

 

As you can see the MSB is read first. I will be doing this several thousand times. What is the most efficient way of doing this? My implementation is not fast enough.

 

Any help or links would be greatly appreciated.

 

John

Download All
0 Kudos
Message 1 of 5
(3,638 Views)
Solution
Accepted by topic author jm346

Please find attached a suggestion.

 

Are your chunks of bits always the same size?

Message 2 of 5
(3,631 Views)

"Are your chunks of bits always the same size?"

The array is actually taken from a .bin file created by dumping data from the NI6541 HSDIO card in U8 format so it'll always be a multiple of 8 I can set.

 

Thanks for the suggestion but could you save it in a lower version for me, preferably the lowest you can? I apologise for not stating it but I am working with Labview 7.1 at the moment. However I can access 8.5 and 8.0 to convert back if needs be, but not 8.6.

 

Thanks again.

0 Kudos
Message 3 of 5
(3,623 Views)
I converted it and it appears to work. Thanks.
0 Kudos
Message 4 of 5
(3,605 Views)

I'm a little confused as to how you can say it works because it does not give the same output as your VI. If you plug in the constant that you have on your block diagram in Jorn's code you will see that the output of Jorn's VI is incorrect. The reason is that the Reshape Array is not being done correctly. See attached picture for correction.

 

0 Kudos
Message 5 of 5
(3,586 Views)