LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS interleaved reading/writing

I'm using an interleaved TDMS writing steup for long-term datalogging. The VI which acquires the data seems to work fine, but I can't seem to read it properly.

The data is generated in large blocks, and written asychronously. That is, the VI takes about 60 seconds of data in, writes it out, and then loops until the total logging time is reached. This was implemented so that LV doesn't keep the entire waveform in memory when logging, which could last for up to a week.
Specifically, for data in 3 channels, what I should get when reading is

 

 

x y z
x y z
x y z
x y z
x y z
x y z
x y z
x y z
x y z
x y z
x y z
x y z

 

Instead, what I get is

 

x x x
x x x y y y
y y y z z z
z z z x x x
x x x y y y
y y y
z z z z z z

That is, for each block of data logged, when I read the data in (using the Excel TDM plugin or using LV), the channel data is placed across all columns, and is apparently each block becomes interleaved.

 

I haven't had success changing the program that writes the data to create significantly different results. MATLAB seems incapable of reading the data, even with the many different functions available, including the offical NI DLL.

 

I've attached the VI I'm using to read out the data, and an example TDMS file which exhibits this effect. Any help is appreciated.

 

 

Download All
0 Kudos
Message 1 of 4
(3,628 Views)

It's not "becoming interleaved", that's how you're writing it.

 

Probably you're writing a 2D array of your data to file?  Try simply transposing the array when writing it, TDMS requires the rows and columns to be ordered in a certain way and if this doesn't match your data, transposing might solve the problem.

 

I couldn't look at your code, I've only got LV 2012.

0 Kudos
Message 2 of 4
(3,606 Views)

In your case, is it writing for multiple times and each time of writing, it writes 6 data values?

If so, try to use TDMS defragment, and see whether it helps.

0 Kudos
Message 3 of 4
(3,583 Views)

I was suspicious of this in the beginning but I had previously been using the "Write to Measurement File" VI and had no problems with that. However, upon transposing the data the problem seems to have been recitified. Interesting how that works, I wouldn't have expected it to matter.

 

Incidenally, after using the Transpose Array function I was unable to wire the data, a 2D array of double, into the TDMS Asynchronous Write VI. The output of Transpose Array was apparently a "2D (sub)array of double" which was somehow incompatible as-is. I had to convert to a matrix and then back to an array to get the write VI to accept the data.

 

Anyways, the data seems to write and read correctly now.

0 Kudos
Message 4 of 4
(3,548 Views)