Unexpected Values When Replacing Channel Data Using Advanced TDMS Functions in LabVIEW

Updated Sep 18, 2020

Reported In

Software

  • LabVIEW

Issue Details

I have an existing TDMS file, and I want to modify the values stored for a particular channel. Here is the current file: 

All the channels belong to the group called Channels. I am trying to replace the values of CH6. The current channel values are [10,10,10], and I would like to replace them with [1,1,2]. To do this, I am using the Advanced TDMS functions: 


When I run the code, the resulting file contains garbage values for CH6:

How can I fix this?

 

Solution

This problem occurs when the data type of the new values does not match the data type of the existing values. In the previous example, the existing values for CH6 were stored as DBL data types. This means that the replacement values should also be DBLs, as shown here:

When using the correct data type, the TDMS file will be updated correctly:

Additional Information

The regular (i.e. not "Advanced") TDMS functions allow you to use any data type, and any necessary coercions will be processed internally. The Advanced TDMS functions are optimized for cases like asynchronous operations and faster streaming, and part of these optimizations include a lack of data coercion.