LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert 3D waveform to 2D waveform and ultimately to a 2D array

Solved!
Go to solution

My data collection loop ends up generating a 3D array of waveforms which I now need to ultimately reduce to 2D array of data.  I can't seem to find an easy way of doing this, at it seems like there certainly should be since I suspect lots of people are collecting n-data points per loop iteration in order to watch the progress of their experiment in "real time".  I saw a previous posting about this, but the solution was shown in a LabVIEW version later then my 8.2 so I can't open it.

 

At the end of the data collection process I have a 3D waveform consisting of 400 "pages", each page containing of a 2D waveform of 5 "rows" of data (one row for each AI channel) and  20 "columns" (data points per row).  So now I want to transform all of these data into a single 2D waveform of 5 rows by 8000 columns (400*20=8000 data points per channel).  I can't seem to get the 400 sets of 20 columns to concatenate/append to one another.  I always seem to get either an empty array, a single 5x20 array or a 2000x20 array.

 

Once that portion is done (and written to disk) I then need to create a 2D array of these data values so I can perform the rest of the calculations and analysis.

 

I would appreciate and help you could provide.

0 Kudos
Message 1 of 9
(3,997 Views)

Not sure about the waveform to array, someone else can give your more insight on this. But here is how to convert a 3d array to a 2d array the way you want (taking pages and appending to the 2d array)

 

Message Edited by for(imstuck) on 11-05-2009 09:58 AM
0 Kudos
Message 2 of 9
(3,983 Views)
I tried your code on a 3x4x5 (3 pages, 4 rows and 5 columns) and I got a 12 row x 5 column 2D array.  What I'm looking for is the 4 row x 15 column 2D array.
0 Kudos
Message 3 of 9
(3,973 Views)

sorry, more like this? Replace the 5 with whatever you need to there.

Message Edited by for(imstuck) on 11-05-2009 10:39 AM
0 Kudos
Message 4 of 9
(3,968 Views)

It's getting closer!!  If I start with a 3x4x5 3D array I now get a 4x15 2D array, unfortunately I get the same column data repeated 3 times across:

 

If the first pages' row data is 1 2 3 4 5 then I get the first row in the 2D array looking like 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5.  I am loosing all of the subsequent page data.

0 Kudos
Message 5 of 9
(3,960 Views)
Woops!!! get rid of that constant zero and wire the counter (i) in the for loop where the zero is now. Then you got it. This is what happens when you do this stuff quickly and don't think it through:)
Message Edited by for(imstuck) on 11-05-2009 11:07 AM
0 Kudos
Message 6 of 9
(3,956 Views)
Solution
Accepted by topic author MJHanagan

Hi,

 

Does this help?

 

 

 

cheers

 

David

 

Message Edited by David Crawford on 11-05-2009 05:04 PM
Message 7 of 9
(3,955 Views)

Just had to finish what I started (and did wrong three times 🙂 ), despite david beating me to it. If nothing else, it shows there is more than one way to skin a cat, but looking at his functionality I think it would be more efficient to go with his method(especially with a fairly large array).

Message Edited by for(imstuck) on 11-05-2009 11:13 AM
Message Edited by for(imstuck) on 11-05-2009 11:17 AM
Message 8 of 9
(3,944 Views)

Ahhh, yes!  Both ways work!  Many thanks to you both.

 

Seems odd to me that this concatenation of 3D to 2D doesn't seem to be covered in either or the two LabVIEW books I have.

 

I will see if it can be applied to 3D waveforms, standby...

0 Kudos
Message 9 of 9
(3,936 Views)