LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I open a tdms file and replace a subset of data then save that change without re-writing the entire file again?

Hi all,

 

Is it possible to open a tdms file and make a small change an an array subset then save the file without having to save the whole dataset as a different file with a new name? That is to say, is there something similar to "Save" in MS Word rather than "Save As"... I only want to change a 1D array of four data points in a file of 7M data points.

 

I am not sure if this make sense? Any help is apreciated.

 

Thanks,

Jack

0 Kudos
Message 1 of 6
(3,428 Views)

Hi,

 

I think this is not possible with built-in TMDS basic functions.

 

However, you can easily make a simple VI what reads out all the group names/channel names, property names/values, and channel data.

You modify/delete/replace the desired set of data, and create a new tdms file and write back what you want.

7M data points is not a large amount, nowaday PCs have Gbytes of RAM....

0 Kudos
Message 2 of 6
(3,393 Views)

You can use the TDMS Advanced functions to do what you would like to do (see TDMS Set Next Write Position.vi).  Read up on them in the LabVIEW help before getting started.  Let us know if you run into issues.

 

Note that these are a fairly recent addition, so if you have an older version, you may not find them.  If this is the case, let us know.  There are other options.

0 Kudos
Message 3 of 6
(3,376 Views)
Hi DFGray, Many thanks for getting back to me... The tdms file will be closed (I open the file, get the data for display/processing, then close it; data is in a shift register)... Should I use "Advanced Synchronous Write" or "Advance Asynchronous Write" after the "Set Next Write Position" for when I go to rewrite part of the data file? Thanks. Jack
0 Kudos
Message 4 of 6
(3,351 Views)

You can use either one, but for your application, I would use the synchronous.  It requires far less setup.  When you open the file, set both enable asynchronous and disable buffering to FALSE to enable you to use synchronous with arbitrary data sizes.

 

Attached code is LabVIEW 2011.

0 Kudos
Message 5 of 6
(3,335 Views)

Thank you!

0 Kudos
Message 6 of 6
(3,295 Views)