LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting 32-bit binary arrays (rows) from a 2d array that meet certain criteria.

I need to split a 2d array into 4 separate 2d arrays where each row in the 2d array is a 32-bit binary number which contains various data. A brief example:

1111100000010101000111100000000
1111010000000000010000000000000
1111000000000000100000010000000

I wish to separate my existing 2d array of data into three separate files depending on the type of data, the type of row. For example, I want all those rows containing a '1' in a certain column to be sent to a specific index to further be altered to be split.

I am new to this, and I can't see a clear and easy answer. I hope to eventually do this separation of data in realtime and not from reading a spreadsheet file...

Thank you
for your time!

--Sasha
0 Kudos
Message 1 of 6
(3,042 Views)
I'm not exactly sure what you are trying to do, but there are some tools you need to be aware of.

In the Array palette, you will find a function "delete from array". One output of this function is the deleted row or column. You may have to adjust your array (transpose it) to get the correct results.

Another toolset to be aware of is the advanced palette under data manipulation. There are a number of tools for splitting and joining binary numbers. I don't know if this will help, but it should be good to know of these tools anyway.

As for your filtering, I'm not sure on that. Perhaps if you could explain it in more detail, someone could offer some assistance.

Good luck, I hope that helps.
0 Kudos
Message 2 of 6
(3,042 Views)
It sounds like you want the bits to steer you data.

Each "collumn" says what to do with some data.

In your example you show a 2-d array of booleans.

Index off the collumns and convert the selected (3) bits to an intergger.

This would give you a 1-d array of (based on your example, high bit at the bottom);
7
7
7
7
1
2
0
0
0....etc.

Wire this to a case.

In the "7" state do whatever (3) 1's indicate.
In "0" state do what (3) 0's indicates.
In the "1" case do what ever a one in the top row means.

For (3) stearing bits you will need a case structure with (9) states (one to catch errors that would otherwise be a real pain to find).

Are we getting close yet?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 6
(3,042 Views)
I believe that the delete array function is close to what I need. Basically, I am receiving 3 types of data from a QDC card all on the same bus, and I need to separate the 3 types of data based on the 25th, 26th, and 27th column. For example, the row

1111100000000000000000000000000

will be characterized as data '100' and should be extracted from the 2d array into another array to be saved later. The following row

1111010000000000000000000000000

would be characterized as data '010' and so that entire row of data would be extracted and saved to another array.

In the end, I need to have my initial 2d array with n rows of a 32-bit boolean word as shown above separated into 3 separate arrays or files based on their characteristic 3-bit identifier.


--Sasha
0 Kudos
Message 4 of 6
(3,042 Views)
Index through each of the rows pulling out 1 32 bit value in each pass.

Take array subset to get the three bits you want.

Convert these to an interger.

Follow other recomendations I cited in my previous response.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 6
(3,042 Views)
What you really ought to do is NOT convert the array of 32bit integers
into
a 2D array of booleans or integers in the first place. That would be
very inefficient.

Instead create a binary mask for your data where the 26th, 27th, and
28th bits (based on your email) are equal to 1 (i.e. 0x0E000000) and
the other bits are zero. AND the mask with your incoming U32 data and
then rotate right 26 bits. This will give you a case between 0 and 7
to use for processing.

You should be able to do these two steps on the whole array of U32's
in one iteration. You can feed your original data array into a for
loop and inside the for loop will be a case structure with 0 to 7 for
the cases where you can process the data elements based on case#.

I think you will f
ind that this approach should be much faster and
simpler than trying to work with the U32's as 32 element arrays.

Douglas De Clue
LabVIEW programmer
ddeclue@bellsouth.net


Ben wrote in message news:<5065000000050000007E900000-1027480788000@exchange.ni.com>...
> It sounds like you want the bits to steer you data.
>
> Each "collumn" says what to do with some data.
>
> In your example you show a 2-d array of booleans.
>
> Index off the collumns and convert the selected (3) bits to an
> intergger.
>
> This would give you a 1-d array of (based on your example, high bit at
> the bottom);
> 7
> 7
> 7
> 7
> 1
> 2
> 0
> 0
> 0....etc.
>
> Wire this to a case.
>
> In the "7" state do whatever (3) 1's indicate.
> In "0" state do what (3) 0's indicates.
> In the "1" case do what ever a one in the top row means.
>
> For (3) stearing bits you will need a case structure with (9) states
> (one to catch errors that would otherwise be a real pain to find).
>
> Are we getting close
yet?
>
> Ben
0 Kudos
Message 6 of 6
(3,042 Views)