LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting large binary array to multiple decimal numbers

Solved!
Go to solution

I have an array of 480 bits that I need to convert to 30 decimal numbers.  Each number will be 16 bits.  

 

I've found example programs that use a for loop that multiplies the 0 or 1 by 2 raised to the power of the iteration number.  The issue with this is that once the iteration reaches 15, I need it to restart to zero and repeat.  I am not sure how to do this. Any help is much appreciated.

 

Andy

0 Kudos
Message 1 of 2
(811 Views)
Solution
Accepted by topic author tricket

If this is, indeed, a LabVIEW Boolean Array of length 480, transforming it to an array of 30 U16 number is fairly simple.  First, use Reshape Array to turn your Array into an Array with 30 rows and 16 columns.  If you run this Array through a For loop, each "loop" will deal with a 1D Array of 16 Booleans, which can be run through the Boolean Array to Number function to give you a U16 quantity that, when brought out of the For Loop through an Indexing Tunnel, gives you 30 U32 quantities, just what you need.  [If you would rather have I16, add a To Word Integer function somewhere on the U16 path, either inside or outside the For loop].

 

Bob Schor

0 Kudos
Message 2 of 2
(803 Views)