From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Reading TDMS File In Chunks

Hi all,

 

I am having some major problems reading in all channels from a tdms file in chunks (to reduce memory load). The code below reads all channels, but does not loop to build an array. Only the first iteration of the while loop is read.... Any suggestions greatly appreciated.

 

Many thanks.

Jack

 

Read TDMS.png

 



0 Kudos
Message 1 of 14
(4,139 Views)

Hi Jack,

 

what is the reason for "Only the first iteration of the while loop is read"? Why doesn't it work correctly in the next iterations?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(4,118 Views)

Maybe a little more info would be helpful.

 

Does the loop stop after the first iteration, or is it still running, but not reading anything?

 

Are you getting any errors at the end of the run?

0 Kudos
Message 3 of 14
(4,106 Views)
Hi all,

I want to read to whole file (all channels) in smaller chunks.... When run, only the first iteration shows on the graph with an EOF error..

I need the loop to keep running when the file is read for processing.

thanks,
jack
0 Kudos
Message 4 of 14
(4,089 Views)

Hi,

According to the doc of TDMS Read,

"If you do not wire data to this input, LabVIEW reads data from the first group when you run this function for the first time. If you run this function continuously for multiple cycles without wiring the group name in input, LabVIEW reads data from the nth group at the nth cycle. " 

 

In your case, even you have "offset" and "count" wired, TDMS Read reads data for the next group in your loop instead of next chunk of your current group. My advice is that you can use TDMS List Contents to get all the groups and channels, then read all channels one by one and chunk by chunk.

0 Kudos
Message 5 of 14
(4,061 Views)
Hi deppSu,

Is it a simple matter of wiring both straight through? I thought I did this and it still did nota work.... Will try again when back in the office..

Thanks.
Jack
0 Kudos
Message 6 of 14
(4,056 Views)

Hi deepSU,

 

Please see the attached... I assume I have inserted the "List Contents" vi into the correct location...

 

Still not worrying as needed? Each chunk loads as a different channels and arrays do not append,

 

Thanks,

Jack

0 Kudos
Message 7 of 14
(4,020 Views)

I don't think you can get the "NI_ChannelLength" from a TDMS group instead of a Channel. Except for that, your VI looks O.K. to me.

One thing to notify is that the chunk you set means samples not bytes. And you can observe your tdms file by TDMS Viewer to see the actual length of your channels.

My question How many iterations does your loop run? If it's possible you can upload your TDMS file and we can see if your VI works.

0 Kudos
Message 8 of 14
(3,988 Views)

Hi deppSu,

 

See attached vi... This now reads all data in chunks BUT each chunk does not concatenate as required? Each chunk is stored in a new row.

 

Surely this is a simple fix?

 

The tdms file (and index) will not attach as I get a "The file does not have a valid extension for an attachment" error on upload?

 

Thanks,

Jack

0 Kudos
Message 9 of 14
(3,977 Views)

Hi all,

 

Could someone please help with this? Getting desparate....

 

Thanks,

Jack

0 Kudos
Message 10 of 14
(3,951 Views)