LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace a value of a channel (1D DBL array) in a TDMS file

Solved!
Go to solution

Is there a simple way to replace a value of a channel (e.g., a 1D DBL array) in a TDMS file?

I can

  1. read out the whole channel, replace the value in the channel, and then write to a new TDMS file.
  2. delete the data in the channel in the old TDMS file (using the "TDMS Delete Data" node), and then rewrite the data to the channel.

They both work but both are too slow due to overhead work. If there is a direct and easier way, I would love to know.

 

Thanks.

 

XL

0 Kudos
Message 1 of 3
(986 Views)
Solution
Accepted by topic author XLEagle

Hi XL,

 

TDMS is optimized for writing measurement data to files very fast. It's not meant to edit such files later on - but you can do so using the approaches you already mentioned.

 

I can suggest one more way:

When you know the underlying datatypes you could overwrite the value in the file directly using WriteBinaryFile. All you need to do is to search/find the correct position of the value in the file… 😉

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(965 Views)

GerdW

Thanks for your suggestions, good to know that I am not missing an easy method to do it. 

I am actually migrating files from binary to TDMS to take advantage of some of the TDMS functions. 😄

Knowing there is not an easy way to replace data in a TDMS file, I am planning to write to TDMS with new data, and when read,  just read the whole data set, and remove the data to be replaced. On top of that, I will consolidate data and save to a new TDMS regularly.

Thanks.

XL  

0 Kudos
Message 3 of 3
(920 Views)