# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Converting large binary array to multiple decimal numbers

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

Message 1 of 2
(1,448 Views)
Solution
Accepted by topic author tricket

## Re: Converting large binary array to multiple decimal numbers

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

Message 2 of 2
(1,440 Views)