TDMS Data Logging DAQmx Data From Multiple Loops To The Same File

Updated Apr 17, 2018

Reported In


  • NI-DAQmx

Issue Details

I have multiple separate DAQmx channels that are acquiring different data at different rates. I want to log them to the same TDMS file. Is this possible without introducing a race condition


  • The best approach to this problem is to use a Producer / Consumer Architecture in which you have your data loops writing to a Queued Message Handler.
    • Log your data using the DAQmx TDMS functions in your Consumer Loop
    • You can have multiple producer loops with different rates, but only one consumer loop
    • The data type for the queue would be a cluster of a string and a variant. 
    • The string is used to tell what the data is (which channel it is coming from), and the variant is used for the actual data.
    • Thus, you avoid the race condition if you tried to write to the same file in two simultaneous loops.


Not Helpful