File Exchange Pick of the Week

Our best user submissions

Convert TDMS

Sean's pick this week is ConvertTDMS by Brad Humphreys.

I'm asked occasionally by LabVIEW users who want to use MATLAB for analysis if it's possible to read TDMS files. I typically recommend looking at our data acquisition products to stream the data from a National Instruments device directly into MATLAB. However, this isn't always an option as many files already exist or the infrastructure has been built in LabVIEW.

The convertTDMS function makes this possible and returns a structure with TDMS data. Optionally, it can also save the data to a MAT file so you don't have to read or convert it twice.

s = convertTDMS(false, 'filename', fullfile(pwd, 'exampleFiles', 'simple_test.tdms'))

Converting 'simple_test.tdms'...

Conversion complete.

s = 
  struct with fields:

         FileName: 'simple_test.tdms'
       FileFolder: 'C:\Documents\MATLAB\potw\ConvertTDMS\exampleFiles'
    SegTDMSVerNum: 4713
    NumOfSegments: 1
             Data: [1×1 struct]
plot(s.Data.MeasuredData(3).Data)
xlabel('Sample')
title(s.Data.MeasuredData(3).Name)

I also like how this file has evolved over time with many different contributing authors and the project migrated to GitHub.

Comments

Give it a try and let us know what you think here or leave a comment for Brad.




Published with MATLAB® R2020b

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.