LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting a 2D array to a 1D array

you get an extra kudo for reading my mind. :smileywink:
0 Kudos
Message 11 of 20
(2,349 Views)

hi c.minnel, thanks for taking ur time out. but unfortunately ur code is for labview 8.6, where as i have 8.5 version. so its not working for me. can u convert it to 8.5 please.

secondly, please have a look at this code. it is converting the bitstream(1D array) to JPEG or 2D array.

if any one can explain this please.

i ll appreciate if some one explains this rather than proposing another solution.

also a better explanation of the previous code(converting 2D array to 1D array) is still required.

thanks

0 Kudos
Message 12 of 20
(2,333 Views)

altenback, ur solution worked equally good. 2D array is converted to 1D array. but i need an explanation some things.

now if i want to convert the bitstream(1D array) back to the 2D array(picture), so can u propose a solution here.

0 Kudos
Message 13 of 20
(2,331 Views)

irish_sunset wrote:

altenback, ur solution worked equally good. 2D array is converted to 1D array. but i need an explanation some things.


Well, we cannot convert directly to 0,1 because we want a number for each bit, i.e. 32 bits per number. If you would convert directly (and I am not even sure what that means!), you'll only get one bit per number.

 

Due to the autoindexing at the FOR loop, we get a 3D array. Reshaping it to a 1D array with a size of the product of the dimensions is the output we want. Why don't you simply place a few indicators or probes at the various locations and simply test for yourself with some simple input data?


irish_sunset wrote:

now if i want to convert the bitstream(1D array) back to the 2D array(picture), so can u propose a solution here.


That's trivial too. What have you tried so far?

Message Edited by altenbach on 05-15-2009 09:00 AM
0 Kudos
Message 14 of 20
(2,315 Views)

irish_sunset wrote:

now if i want to convert the bitstream(1D array) back to the 2D array(picture), so can u propose a solution here.


Cinverting back is only possible if you know at least one of the dimensions of the image. This information is lost. You probably should add e.g. the first dimension encoded in the first 32 bits of the output, for example.

0 Kudos
Message 15 of 20
(2,309 Views)

 this is the code for converting three 1D(bitstream array back to 2D array(jpg picture). i am not completely understanding it. explanation of this code is required.thanks

 

0 Kudos
Message 16 of 20
(2,271 Views)

the code in the prevous message is working fine, but as i am new to labview so i am not getting as to what is happening in the code and how is it working.

thanks

0 Kudos
Message 17 of 20
(2,258 Views)

Remember, each bit was expanded to require 8bits of space (each U8 represents 1 bit). So if you take the total number of elements divided by 32, that tells you how many U32's there were originally. The second chunk of code divides the array into 32 element blocks that are then converted into U32's. This reconstitutes the original U32 array, but only in one dimension. That last chunk of code converts the 1-D array into a 2-D array of the size defined by the 2 elements in the JPG Size array. Again, this isn't the best way to do all of this, but if it works, it works.

 

Chris

0 Kudos
Message 18 of 20
(2,253 Views)
thanks chris, but can u propose a better solutin for converting the 1D array back to 2D array, than the one posted by me.
0 Kudos
Message 19 of 20
(2,209 Views)

I guess what I mean is, it seems like this whole process is kind of silly and inefficient. If you have equipment that really needs to see a bit stream like this, than it's all good. But if you have any flexibility over the process I would take a look at our earlier suggestions that didn't involve expanding every bit into 8 bits.

 

I will be out of the office for a while, but if you post a question, I'll try to get back to you when I get back.

 

Chris

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