Showing results for 
Search instead for 
Did you mean: 

TDMS file will not properly import into Matlab

Go to solution

Thanks for letting me know Mike, that will be really fantastic if you get it approved.


Best regards,




0 Kudos
Message 11 of 24

Thanks for posting the example TDMS file. I found a few small bugs in my code, which I should hopefully be releasing to the FEX in a few days, it just needs a few more features ...

0 Kudos
Message 12 of 24
Accepted by topic author Mike8977



Attached is my solution to processing TDMS files into MATLAB. It uses the TDMS processing DLL stuff from NI ( but throws away their example script. I am posting three files here in the zip. The readme.txt is obviously a description of the project and setup directions. The importTDMS.m file is the key. That file makes use of the NI provided DLL to process TDMS files and create a useful MATLAB structure out of it. The plotTorDAC.m file is an example of how one can "search" for specific items within the resulting MATLAB strucure in order to plot, print out, etc. You will not have a "TorDAC" TDMS file that has the expected group/channel structure for it to be directly useful, but I have included it in case there is some useful content in the way I do things in there.


Let me know if you have questions and I apologize for any bugs that remain. Hopefully this will help people out. Sorry it took so long to get Public Release approval on this.



Message 13 of 24

I've uploaded my solution to the Matlab File Exchange (TDMS reader).  It doesn't rely on a driver and should support TDMS v2.

0 Kudos
Message 14 of 24

I was able to use importTDMS.m for my tdms file (300MB) which was generated by SignalExpress but it returns me followings:


ans =

filenameTDMS: [1x82 char]
property: [1x25 struct]
group: [1x7 struct]


>> whos
Name Size Bytes Class Attributes

ans 1x1 309319412 struct


Does this code allows to extract actual measured values?


0 Kudos
Message 15 of 24

Yes, the code allows you to extract your data. Based on what you pasted in your post, it appears that you have just returned the entire contents of your TDMS file to MATLAB's default variable "ans". It is a MATLAB struct and everything is inside it. Each vector of values is buried within the MATLAB struct that is created to mirror the hierarchy of the TDMS file. Individual channels are within groups. It looks like you have your channels in 7 groups. The actual data values for one channel would be in "" (meaning you could put that in a plot command without the quotes of course).


Try using the command line form of the importTDMS script and set the last input to true to display a hierarchical view of your file once it is done being processed. For example, "tdmsStruct=importTDMS('C:\file1.tdms',true,true)".


Take a look at the help for the function (type "help importTDMS" at the MATLAB prompt). If all else fails, just dig through the returned MATLAB struct in the MATLAB variable editor window.



0 Kudos
Message 16 of 24

I am getting an error using your script:


??? Error using ==> loadlibrary at 264
A 'Selected' compiler was not found.  You may need to run mex -setup.

Error in ==> importTDMS at 120



I have nilibddc.dll in the same folder. Any ideas? Thank you for your help.

0 Kudos
Message 17 of 24




Thank you so much for your help. It worked for me.

I have 32 and 64 bit MATLAB installed in my 64bit Windows 7 machine.

It worked albsolutely fine for my 32 bit MATLAB  and I have able to pull measured data but it is not working for 64 bit MATLAB and I think I found its solution to make it work in 64 bit from mathwork central:



Thank you.

0 Kudos
Message 18 of 24



I had a similar problem when I run 64bit MATLAB in 64Bit Windows 7 machine.

I found solution for it from matwork central:


I didn't tried it yet as i am busy with some other stuff.


You can try it and let me know if it work for you.


Thank you.

Message 19 of 24



This worked for me. Thank you so much!

0 Kudos
Message 20 of 24