LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating 2D Boolean Array 12 bits per row from a 8 bits per row given initial sample

Solved!
Go to solution

Hey guys first time poster I have been stuck at this point for a couple days now.

Im trying to take a 24 bits per row 2D boolean array sample i've reshaped from originally 8 bits per row, just repeated the 8 bits 3 times over to get 24 bits per row.

 

Now my problem is when I'm trying to convert this 24 bits per row 2D array into a single 2D array that consists of one 12 bit sample per row. It would generate this 12 bit sample from the 24 bits per row and would consist of the first 12 bits from the 24 bit per row 2D array in the first row and the 2nd row would have a particular assortment of the 24 bit row 2D array which I have indexed in my VI. And this combination would repeat. 

 

Now really sure how to build the single 2D final array from my 24 bit per row array. And I know what the end result 2D boolean array should look like based on this initial sample and im not close. Need help at that point. 

 

Ive attached my code to help explain but any help about my situation would be awesome!

 

Thanks.

0 Kudos
Message 1 of 20
(2,960 Views)
  • All of your "insert into array" should be replaced by "build array".
  • reshaping to the product of dimension with 24 columns makes the array way too big.
  • ...

@RichardTalbot wrote:

And I know what the end result 2D boolean array should look like based on this initial sample and im not close.


It would help if you also tell us how it should look like. It is not clear from the description.

 

 

 

 

 

 

0 Kudos
Message 2 of 20
(2,933 Views)

The attached code does the same as your VI except the output is sized correctly.

  1. repeat each 8 bit row 3x to create 24 bits/row
  2. reshape to 12 bits per row.
  3. All in one step.

In what way is the output wrong?

 

0 Kudos
Message 3 of 20
(2,932 Views)

Hi Richard,

 

Hey guys first time poster

Welcome!

For "first timers" I usually recommend the free online resources to learn LabVIEW

 

Im trying to take a 24 bits per row 2D boolean array sample i've reshaped from originally 8 bits per row, just repeated the 8 bits 3 times over to get 24 bits per row.

Ok, that's what your VI is meant to do?

Why not use a loop like this:

check.png

(You might also get away without loop and/or excessive IndexArray/InsertIntoArray functions!)

 

Now my problem is when I'm trying to convert this 24 bits per row 2D array into a single 2D array that consists of one 12 bit sample per row. It would generate this 12 bit sample from the 24 bits per row and would consist of the first 12 bits from the 24 bit per row 2D array in the first row and the 2nd row would have a particular assortment of the 24 bit row 2D array which I have indexed in my VI. And this combination would repeat.

- In your VI you are indexing columns - but in your text you want to handle rows!?

- What is a "particular assortment of the 24 bit row 2D array" in the 2nd row?

- What should "repeat"?

 

General recommendation:

- NEVER insert into an empty array. Whenever you (think you) want to do this you should use BuildArray…

- Learn usage of loops, the autoindexing in loops and usage of shift registers in loops. This will help you handling arrays a lot!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 20
(2,928 Views)

Thanks for the quick replies everybody didnt realize it would happen so quickly!

The final product should look like what I have attached sorry I didnt attach it earlier.

 

I can get to the making of 24 bit rows part and your suggestions are much more effcient than mine I will implement a combination of what has been posted and not insert into array.

 

My problem is rearranging the 24 bit row array as you can see when comparing the initial and final product, I need to rearrange the 24 bit row accordingly and then change it to a 12 bit per row with the final product ive attached. The proper arrangement order is in my first code posted where I take all the index array subsets (0-11 for first 12 bits and 16-15 for second 12 bits).

 

Thanks again for the help Ill try again at it and might be able to get it myself

0 Kudos
Message 5 of 20
(2,907 Views)

Hi GerdW,

 

The assortment to my understanding is of the columns, I essentially have to rearrange the index's of the columns in the 24 bit row and then change it to 12 bits per row for the final output. I posted the final product in my second post and the assortment as well. 

 

Thanks for all the advice though!

0 Kudos
Message 6 of 20
(2,904 Views)

@RichardTalbot wrote:

... and 16-15 for second 12 bits).

 


Can you explain that with an example?

0 Kudos
Message 7 of 20
(2,902 Views)

For sure I can try.

So we have the initial input which is given and its in a 8 numbers per row format lets say 1-8 for the first row as an example.

 

What I think I need to do is change this row into 24 numbers per row format, which is a repeat of this initial sample 3 times over. Then the tricky part is that from these 24 numbers per row we want to extract a 2 samples of 12 numbers, the first sample being: 0,1,2,3,4,5,6,7,8,9,10,11 indexes of the 24 number row (first 12 numbers) and then second sample being: 16,17,18,19,20,21,22,23,12,13,14,15 indexes of the 24 number row (particular arranged index assortment based on what im trying to accomplish). Then from this I need to conclude in a 12 number per row array with one sample per row, following after one another. Ex. first row = first 12 numbers of 24 number row array, whereas second row = particular assortment of the last 12 numbers of 24 number row array.

 

That is what I think I need to do to produce the output array. Hopefully that helps

0 Kudos
Message 8 of 20
(2,898 Views)

So, shouldn't the output have twice as many rows as the input?

0 Kudos
Message 9 of 20
(2,894 Views)

Yeah, im not worried about the number of rows just the row length.

0 Kudos
Message 10 of 20
(2,890 Views)