LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS read order error

Solved!
Go to solution

TDMS experts, please tell me I am not crazy.

 

I recently tried to read several channels out of a TDMS file (using LV 8.6.1), and the data was returned ok, except the 2D array that was returned has the channels in the wrong order. I did the read by passing in an array of channel names, and assumed the data would be returned in the same order as I had asked for them. Instead it seemed to come back in the same order that Diadem displays the channels (i.e. the order  in which the individual channels were written to the file).

 

As many of the channels contained similar data, this would have gone completely unnoticed has it not been for one of the channels (a timestamp) which I recognised as being in the wrong place.

 

So my question is: should the TDMS read function (with multiple channel names) return data in the order I ask it for?

 

Of course the work-around is simple enough, I just loop over my channel name array and do single channel reads from the TDMS file, but this seems clumsy.

 

Any thoughts?

 

I can post the code, but it really is trivially just using a TDMS read primitive (also my TDMS file is several hundred megs). 

Message 1 of 6
(4,207 Views)
Solution
Accepted by topic author Neil.Pate

Hi nrp,

 

I've tried this and the problem can be reproduced. It's a bug for sure, and seems exisiting for several versions of LabVIEW. The reason is that the order is actually incorrectly determined by the oder of writing the data.

 

Thank you for finding and reporting the problem. R&D guys already got the bug report and sorry for the inconvenience.

 

Yongqing

NI

Message 2 of 6
(4,197 Views)

YongqingYe wrote:

 

 

I've tried this and the problem can be reproduced. It's a bug for sure, and seems exisiting for several versions of LabVIEW. The reason is that the order is actually incorrectly determined by the oder of writing the data.

 

Thank you for finding and reporting the problem. R&D guys already got the bug report and sorry for the inconvenience.


Can you please post the CAR# here for reference

Message 3 of 6
(4,188 Views)
Sure, it's #188716
Message 4 of 6
(4,185 Views)

YongqingYe wrote:

Hi nrp,

 

I've tried this and the problem can be reproduced. It's a bug for sure, and seems exisiting for several versions of LabVIEW. The reason is that the order is actually incorrectly determined by the oder of writing the data.

 

Thank you for finding and reporting the problem. R&D guys already got the bug report and sorry for the inconvenience.

 

Yongqing

NI


Thanks Yongqing,

 

I am glad I am not crazy, but quite disturbed that this bug exists (and has for serveral version of LV!!!!)  and does not seem to be well known (at least to me!).

 

At least, as I said in my first post, the work around is very simple. But it is probably more efficient from an IO point of view to read all the desired channels at once. Lets hope this one gets fixed soon...

0 Kudos
Message 5 of 6
(4,150 Views)

Hey guys,

 

Thread may be old, but I might have a better fix for you, nrp.

 

I've noticed this too (in 2009 with tdms 2.0), but I have also noticed that if you wire the "channel names out" output, you get an array of channel names that matches the order of the data arrays.  If  you call the TDMS read function with a 10-element array with 7 correct names, 3 incorrect names, and 2 duplicates, you will only get a 6-element array back, in whatever order the TDMS file has internally. I suggest always using this output with TDMS read when you're using arrays of channels.

 

I like it like this, it lets me decide whether I want to spend the effort to enforce a certain order.

 

Clearly it needs better documentation.

-Barrett
CLD
0 Kudos
Message 6 of 6
(3,928 Views)