LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Formatting

I'm trying to figure out a way to change a format my array output looks like. For instance, I have a 2D array of data that puts out set of values in a column for same cycle in while loop, and puts next set of values in the column to the right. What I want is instead of stacking up values horizontally, have a column of all data. So, I would have a first set of data on top of second set of data, and so forth. Does anyone have suggestions?
Thanks.
0 Kudos
Message 1 of 5
(3,148 Views)
If I understand you correctly, you want only a 1D array with all data appended linearly.

How are you building your array? If you use the build array node, righ-click on it and select "concatenate inputs" (of course you need to start with a 1D array in this case.)

If you want to convert your array after the fact, use "reshape array" and make a 1D array with length set to the product of the dimensions of the 2D array (depending on your arrangement, you might need to transpose the 2D array first).

There are many other possible scenarios. If you want more detailed help, attach a reduced version of your code.
0 Kudos
Message 2 of 5
(3,148 Views)
Thanks for the help.
Basically, I have a 1D array within a while loop, so
after each loop 1D array is expanded into a 2D array.

The 1D array is a by-product of waveform line that I split.

The best scenario would be to add a 1D array from loop 2 right below loop 1, loop 3 right below loop 2, as I continue the loop. I just can't figure out how to do it. I already tried "Reshape array," but can't really figure out how to make it work. Any advice on this?

I appreciate your help.
0 Kudos
Message 3 of 5
(3,148 Views)
The attached image shows a few possibilities.

1. build 2D array, then reshape to 1D array.
2. Append to 1D array.
3. build 2D array by indexing, then reshape to 1D array.
0 Kudos
Message 4 of 5
(3,148 Views)
Thank you. You are a genius.
0 Kudos
Message 5 of 5
(3,148 Views)