# LabVIEW

cancel
Showing results for
Did you mean:

## Labview Icon

Is there any icon that i could convert 2D array to 1D array..

thanks ..
:manhappy:
Message 1 of 9
(3,466 Views)

## Re: Labview Icon

Hi Rep...,

yes: it's called 'Reshape Array'!

Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(3,462 Views)

## Re: Labview Icon

"Converting" a 2D to a 1D array is not a well defined operation, so maybe you should tell us how the elements of the 2D array should be arranged in the 1D array.
• "Reshape array" (see image) will basically append all the rows. Is that what you want?
• If you e.g. have a 1 x N or N x 1 2D array and want is as a 1D array of size N, you could use "index array".

Other possible intepretations are e.g.: average all rows (or columns) of the 2D array to yield a 1D array.

Message Edited by altenbach on 11-01-2006 12:41 AM

Message 3 of 9
(3,459 Views)

## Re: Labview Icon

Hello All!

I have a similar problem with arrays. My problem is:

I have a 2D array(size 5X8) called message and a 1D array(size 4) called input 1D array. My application requires that I multiply evry element in the 2D array with the whole(all elements of 1D array). As you can see in the picture attached, I have two for loops auto indexed on the rows and colums of the 2D array respectively. I pass in the 1D array in to the inside for loop without auto indexing. This works fine. However, the problem is that at the output . Every time it multiplies an element (of 2D array)with the 1D array, it goes to a new row, where as I want it to continue in the same row until it reaches to the end of that particular row in the 2D array.

For example, to make it clear: say message = 1 0 1 1 1 0 1 1

1 0 0 0 1 0 1 0

and 1D input array = [100 200 100  500]

Then I need the output array =  100  200 100  500 0 0 0 0  100 200 100  500 100 200 100 500 100 200 100 500 0 0 0 0 100 200 100 500 100 200 100 500

100  200 100 500 0 0 0 0   0     0     0      0     0    0      0    0      100 200 100 500 0 0 0 0 100 200 100 500 0     0     0      0

How ever, LabView gives:         100 200 100 500

0    0      0    0

100 200 100 500

100 200 100 500

100 200 100 500

0    0      0     0

100 200 100 500

100 200 100 500

How can I fix this? Im really stuck. Any help would be really appreciated!!!

Message 4 of 9
(2,955 Views)

## Re: Labview Icon

Hi LSASS,

have you read Altenbachs message just before adding your question? Then the picture he included should give you all you need: just reshape your 2d result to a 1d array (it will append all the rows into just one row)...

But you may also use a shift register and a "build array" to get your 1d array - decide what is easier to you...

Message Edited by GerdW on 04-17-2009 11:45 PM
Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 9
(2,950 Views)

## Re: Labview Icon

Actually, he's trying to go from a 3D array to a 2D array, but the concept is the same. You just have to give it the right number of rows and columns:

Message 6 of 9
(2,945 Views)

## Re: Labview Icon

Hi smercurio,

in the text he gives examples of 2d and 1d...

Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 9
(2,940 Views)

## Re: Labview Icon

GerdW wrote:

Hi smercurio,

in the text he gives examples of 2d and 1d...

Yes, but in the screenshot he has a 3D array. I was confused at first as well until I realized he was showing just one page of the 3D array in the body of the message.

Message 8 of 9
(2,932 Views)

## Re: Labview Icon

HI smercurio and GerdW,

Thanks very much for the help. I just used  the solution given to altenbach's problem in the previous post in my outer loop. that worked just fine. Also, using smercurio's suggestion also worked for me.

My problem is solved...Thanks again:)

Message 9 of 9
(2,917 Views)