Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

02-12-2017 11:07 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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

Solved! Go to Solution.

Solution

Accepted by topic author tricket

02-12-2017 11:24 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

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