LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Random channel order when reading from .tdm file

Hi All,

 

I have an issue that has been bothering me for a while now. My vi creates a tdm file. When I open it in excel, I see the data organized in sequential order. When my VI reads from the file, it seemingly pulls the data channels in randomly.

 

So instead of sensor 1, sensor 2, sensor 3, etc, it shows Sensor 2, Sensor 3, Sensor 1, etc. The data is all correct. It's just the order that is out of sequence. Has anyone seen this before?

0 Kudos
Message 1 of 5
(133 Views)

We probably could help troubleshooting if you would attach a small tdm file and the VI you use to read it.

Terms like "it pulls" are very vague, so we can't really tell what you are doing..

 

(If the VI is in a newer LabVIEW version, use "save for previous" ( 2020 or below) before attaching)

0 Kudos
Message 2 of 5
(129 Views)

Since your channels appear to numbered, you can sort them. When you read back the channel list, is it that which is out of order? Why not read the list, order then, and then pull the data?

 

Found this which may be helpful:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x45cCAA&l=en-US

 

I suspect that you are writing the channels out of order. In excel they are being shown in order alphabetically, but are actually arranged and retrieved in write order. Possible.

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 3 of 5
(95 Views)

Thanks for the replies! My save routine saves to a tdm with XML header and a txt file (for legacy compliance). The same info is fed into both subVIs. The text file maintains the same order but the tdm changes it when I recall the data. If I open the tdm in excel, it shows the correct order. I named the sensors 1, 2, 3, 4, etc. and checked with other alphabetic configurations. I cannot find a pattern.

 

However, I needed to get this sorted for Monday so I 'fixed' it by adding metadata to the tdm save routine with the correct order, then sorting the data when opening the file based on said metadata.

0 Kudos
Message 4 of 5
(76 Views)

@littlesphaeroid wrote:

Since your channels appear to numbered, you can sort them. When you read back the channel list, is it that which is out of order? Why not read the list, order then, and then pull the data?

 

Found this which may be helpful:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x45cCAA&l=en-US

 

I suspect that you are writing the channels out of order. In excel they are being shown in order alphabetically, but are actually arranged and retrieved in write order. Possible.


I have a technique similar to what NI is proposing, and I posted it here.  I've also included it in my Tremendous TDMS toolkit found on VIPM.IO

 

But as others have said the order shouldn't matter in most cases.  There are times when someone just wants to view it in an Excel plugin and then the order can't be controlled, or exporting to a CSV.  But in most cases the data is based on the name of the group and channel.

0 Kudos
Message 5 of 5
(50 Views)