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.
要发表评论，请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。