12-14-2010 07:52 AM
Thanks for letting me know Mike, that will be really fantastic if you get it approved.
Best regards,
Martin
01-12-2011 07:40 PM
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 ...
01-14-2011 11:43 AM - edited 01-14-2011 11:45 AM
Martin,
Attached is my solution to processing TDMS files into MATLAB. It uses the TDMS processing DLL stuff from NI (http://zone.ni.com/devzone/cda/epd/p/id/5957) 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.
Mike
01-17-2011 10:33 AM
I've uploaded my solution to the Matlab File Exchange (TDMS reader). It doesn't rely on a driver and should support TDMS v2.
07-13-2012 12:42 PM
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?
07-16-2012 01:12 PM
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 "ans.group(1).channel(1).data" (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.
-Mike
07-18-2012 11:05 AM
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
loadlibrary(NI_TDM_DLL_Path,NI_TDM_H_Path);
I have nilibddc.dll in the same folder. Any ideas? Thank you for your help.
07-18-2012 11:16 AM
Mike,
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:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/281365
Thank you.
07-18-2012 11:19 AM
katho,
I had a similar problem when I run 64bit MATLAB in 64Bit Windows 7 machine.
I found solution for it from matwork central:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/281365
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.
07-18-2012 04:13 PM
erhk,
This worked for me. Thank you so much!