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

So, simply reshape to 16 columns and take the 12 column subset.

0 Kudos
Message 11 of 20
(887 Views)

Ive tried that and I keep getting an output nowhere near what it should look like. 

0 Kudos
Message 12 of 20
(883 Views)

I don't think your "should be" output is correct. If you are triplicating 8 elements, then the first few elements starting with 0 or 16 are identical, so your rows should start pairwise identical. 

 

As a first step, change the code to numeric and give each element a unique number. Now you can see where things go wrong and what ends up where.

 

Here's a quick example that seems to do what you describe. Modify as needed. Once things fall into place, go back to boolean arrays.

 

ProcessArray.png

Message 13 of 20
(869 Views)

Okay thanks alten! Ill work on that. Im sure I can figure it out from that! 

0 Kudos
Message 14 of 20
(855 Views)

After working on it I realized that it does not repeat the initial input 3 times over.. my mistake. But some progress has been made!

 

I have a VI that is very very close to what I need as an output but im missing one crucial step in generating the array. I know insert into array should not be used but im trying to insert two deleted selections of the 24 bits per row array together then interweave this with the first 12 bits of the 24 bits per row array to generate the "desired output". 

For some reason im missing 5 rows of the the initial input/desired output from my resulting array! This is where my problem lies why are they missing?

 

Thanks again for any help.

0 Kudos
Message 15 of 20
(845 Views)

@RichardTalbot wrote:

 

I know insert into array should not be used but im trying to insert two deleted selections of the 24 bits per row array together then interweave this with the first 12 bits of the 24 bits per row array to generate the "desired output". 

 


You need to be more specific. It does not help if you attach convoluted code that gives the wrong answer. Best would be if you would try it on the numeric array first as in my earlier example. Generate an appropriate input and tell us how the output should look like there.

Message 16 of 20
(843 Views)
Solution
Accepted by topic author RichardTalbot

@RichardTalbot wrote:

After working on it I realized that it does not repeat the initial input 3 times over.. my mistake. But some progress has been made!

 

I have a VI that is very very close to what I need as an output but im missing one crucial step in generating the array. I know insert into array should not be used but im trying to insert two deleted selections of the 24 bits per row array together then interweave this with the first 12 bits of the 24 bits per row array to generate the "desired output". 

For some reason im missing 5 rows of the the initial input/desired output from my resulting array! This is where my problem lies why are they missing?

 

Thanks again for any help.


Here is a little less convoluted way to get your desired output (at least for the first 10 rows). It also will scale for larger data sets. I'm sure there is a better way to do it. I just can't think right now how to build a better mousetrap.

 

I too have NO IDEA where the last 5 rows of data come from. The "initial Input" has 120 elements (15x8 array). If you reformat to 12 columns, you only get 10 rows (10x12 array has 120 elements). There is no more data to process unless you reuse/repeat some of the old data.

 

bd.png

 

 

Message 17 of 20
(834 Views)

I got it! Thanks guys 

0 Kudos
Message 18 of 20
(821 Views)

@jamiva wrote:
Here is a little less convoluted way to get your desired output (at least for the first 10 rows). It also will scale for larger data sets. I'm sure there is a better way to do it. I just can't think right now how to build a better mousetrap.

The main problem is that you constantly resize the array in the shift register for no good reason at all. This can be hard on the memory manager. If this is really the solution (and the number of rows is divisible by three), all we need is the following.

 

We can operate on the original array e.g. as follows, but yes, there are probably still better solutions. 😄

 

ProcessArray.png

Message 19 of 20
(811 Views)

Also, while I hope that the compiler can make my above code operate in place with a single output allocation, I am not 100% sure, given the splitting, appending, and the concatenating tunnel.

 

To be sure that things are done efficiently, we can do the allocation of the output more explicitly. In this case it could look as follows.

 

TwiddleBooleanArray.png

Message 20 of 20
(799 Views)