Measurement Studio for .NET Languages

Showing results for 
Search instead for 
Did you mean: 

Modifying tdmschannel data

Using VS 2010 and MS 2010.


I'm trying to replace a tdms Channels data with modified data. E.g.. : -


I have stored 43 channels of data into a tdms file.


I wish to modify the data in one or more of the channels.


For instance I have 600000 samples of time domain data in channel 1 calibrated in 'G'.


In my program I read the channel 1 data, then multiply it by 9.80555  to obtain 'm/s^2' and wish to overwrite the original data with this new array.


I cannot find away to clear/empty the original data?


If I use channel.appenddata(of single)(new data) then the new data is appended to the end of the original data.


Is it possible to clear/empty the original data so that a new write starts at 0 sample?





0 Kudos
Message 1 of 3

It is not possible to replace a TDMS channel on disk.  There is a technical challenge to make that possible due to the way the data is laid out on disk.  


That being said, there are a couple ways to do what you're wanting to do.


1) Using the TDMS Advanced API, you can call "Set Next Write Position" for a given channel and sample number, then call TDMS Write to replace that sample.

2) If the data that you're wanting to replace with is really just simply a scaling factor (like multiplying every sample by 9.80555 uniformaly), you can do this with scaling properties.  LabVIEW 2009 introduced a new function to TDMS call "TDMS Create Scaling Information".  With this function, you can add scaling information onto a channel such that whenever that channel is read back, the scaling information would be applied to the data.  For example, for this channel, you could create a linear scale with m of 9.80555.  Then, when you read back the data, every value from the original channel will be modified accordingly.


Note that with #1, as the name would suggest, this is more advanced.  If you can do #2, I would definitely recommend it.


Andy McRorie
0 Kudos
Message 2 of 3



I was using the basic TDMS tools but  I was not comfortable with them because I needed to erase a very long channel data. As an alternative, I have written this VI to modify a specific value in a given channel. 



I hope this is useful for other Labview programmers.


0 Kudos
Message 3 of 3