LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sort tdms channels

Solved!
Go to solution

I am reading data from channels of a TDMS file. The channels are different frequencies which data was recorded. However they are not in order. For example the channels might be arranged, 1 Hz, 2 Hz, 3 Hz, 7 Hz, 5Hz, 4Hz. I am trying to either sort these channels in my file. Or another option would be set and "lock" the channel order in the tdms before collecting data.

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

How are you saving to the TDMS file?  Can you share some code?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(3,448 Views)

So its a bit complicated. But basically I will call this vi to save data. I input into it different sample rates. So I might call it with input rates in the following order...1Hz, 2Hz, 4Hz, 1Hz, 1Hz, 2Hz, 1Hz, 2Hz, 4Hz, 8Hz, 1Hz, etc. until I am done.save data.JPG

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

If channels are logged with different frequencies. Than the total count of the channels diffs according to different frequencies, am I right? If so you can use property "NI_ChannelLength" to sort the channels.

 

0 Kudos
Message 4 of 9
(3,411 Views)

Each channel will "fill up" once it hits a certain length. So that wouldn't work 100% of the time. I guess I know I could sort the channels, there doesn't seem to be too easy of a way to do it.

0 Kudos
Message 5 of 9
(3,390 Views)

Programatically it makes more sense to me to sort your channels first. You could dynamically check to see if the "channel" is full then increase the length accordingly.

Ryan
Applications Engineer
National Instruments
0 Kudos
Message 6 of 9
(3,365 Views)

I'm pretty sure that first data points are being written to each channel with proper synchronization. But for some reason, the order of the channels is getting mixed up when I am writing to them. I assumed that once a channel is added to the file, its place is set. Is there a way to create empty channels in the beginning, so the orders are set?

0 Kudos
Message 7 of 9
(3,355 Views)
Solution
Accepted by topic author tda*!

Now I know what you mean. The mixing of channels is because of the "NI_MinimumBufferSize" property which will cache raw data until it reaches the amount you set. 

You are right that once a channel is added to the file, its place is set. Thus, you can try to put a "TDMS flush" right after your "TDMS Set Properties" node. Once channel with properties is flushed to disk file, the place is set.

0 Kudos
Message 8 of 9
(3,346 Views)

Ahhhhh. I thought it might have to do with the buffer size. That did the trick! Thank you.

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