LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenate 2D data

I'm working with 2 buffers of data and trying to display a window of their data. The problem I was having is that the data is organized as 4 rows of N columns. If I want to append more columns onto the array, I need to transpose the source arrays, use Build Array to concatenate them together, and then transpose the result.

 

Is there a more efficient way to append columns into 2D data? I'm guessing that this is an effect of the way the data is organized in memory.

--

Brian Rose
0 Kudos
Message 1 of 5
(3,419 Views)
Why don't you maintain the array in the already transposed position?  Rearrange the way you think about the data being stored rather than rearranging the data every iteration.
0 Kudos
Message 2 of 5
(3,407 Views)

 

Multichannel DAQ signals are fed into the DAQWrite routine as M rows and N columns where M is the channel count and N is the sample count.

 

The problem arose when I converted my single channel DAQ (1D array) to multi channel DAQ (2D array). The regular Build Array worked fine in concatenate mode for 1D data, but it borked things up when I switched to a 2D array for input.

 

After thinking about it, I should transpose it before writing it to the DAQ process, instead of before displaying it. I write to the DAQ buffer once a minute, but I update the display 10 times a second.

 

--

Brian Rose
0 Kudos
Message 3 of 5
(3,403 Views)

I rearranged things to try to get around having to transpose the data. This is what I found.

 

Waveform graphs take data like the DAQ waveforms do. That is M rows by N columns, where N is the number of samples and M is the number of signals. If I need to concatenate two blocks of signals, I need to transpose them, because the Build Array works by appending Array 2's rows to Array 1's rows. This has the effect of adding more channels, instead of adding more samples. I need to append array 2's columns to Array 1's columns, so that I add samples instead of channels.

 

In short, Build Array is the odd man out. I'm guessing that someone made a decision to have channels in waveforms represented as rows, instead of columns. This makes it easier to extract one channel's data, but complicates multi-channel operations.So it looks like i'm stuck with the transpose-concat-transpose operation.

 

Message Edited by Mister Rose on 03-18-2009 02:33 PM
--

Brian Rose
0 Kudos
Message 4 of 5
(3,383 Views)

Mister Rose wrote:

I rearranged things to try to get around having to transpose the data. This is what I found.

 

Waveform graphs take data like the DAQ waveforms do. That is M rows by N columns, where N is the number of samples and M is the number of signals. If I need to concatenate two blocks of signals, I need to transpose them, because the Build Array works by appending Array 2's rows to Array 1's rows. This has the effect of adding more channels, instead of adding more samples. I need to append array 2's columns to Array 1's columns, so that I add samples instead of channels.

 

 

In short, Build Array is the odd man out. I'm guessing that someone made a decision to have channels in waveforms represented as rows, instead of columns. This makes it easier to extract one channel's data, but complicates multi-channel operations.So it looks like i'm stuck with the transpose-concat-transpose operation.

 

Message Edited by Mister Rose on 03-18-2009 02:33 PM

Are you actually working with waveforms?  Or just 2-D arrays?  Remember a waveform array is a 1-D array of waveforms, so each element is a channel, and the array has multiple row because each channel is 1 row.  Each waveform is a special cluster containing a T0, dt, various attributes, and a 1-D array of the Y data.  Each element is a sample and the whole array is a series of samples.

 

1-D arrays are tricky because you can actually display them as either rows or columns.  But in reality, you would consider each element a row, because if you got to 2-D, you add in columns,  3-D you add in pages, 4-D add in "books"....

 

If you are working with waveforms, you can look at the append waveforms function in the waveform palettes so be able to append a series of data in a channel to the end of an existing set of data in another 1-D waveform array.  I don't know if these operations are more efficient or not compared to working with raw 2-D arrays.

 

The missing piece to the question is how you are going from a waveform array (if that is what you are starting with) to a 2-D array that you show in your VI.

Message 5 of 5
(3,372 Views)