NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member DSA
Member
Posts: 42
0 Kudos

Read tdms files with Matlab tdm example

Hi,

I’ve created .tdms file using NI Measurement Studio 8.6.1 and NI DAQmx 9.0. I use the DAQmx function ConfigureLogging to create the file and after, I add custom proporties using the TDMSFile class of MeasurementStudio.

I can easily read the file using the TDM Excel add-in or the TMDS file viewer example in LabVIEW.

Now, I want to open the file using Matlab (I tried with R2008b, R2008a and R2007a). I’ve downloaded the Matlab TDM example and was able to open the SineData.tdm file provided with the example. But when I try to open the tdms file created with my application, the following line of code gives an error :

>> calllib('nilibddc','DDC_OpenFileEx',Data_Path,ftype,1,pfile)

-6210 DDC_CannotWriteToReadOnlyFile - The file passed to the library is read only and cannot be modified.

I get this error even if the file is not read only and was not opened to be modified (the “read only” arg of DDC_OpenFileEx was set to 1 –  only read access).

From that, I receive error -6206 (DDC_InvalidFileHandle) for every other call the the nilibddc related to the tdms file.

Also, I notice that a file named filename.tdms.log was created next to the filename.tdms file and contains the following error message :

ERROR: TDS Exception in Initialize: Tds Error: TdsErrFileVersionTooNew(-2510).

I did not found any information on this error. It is possible that MeasurementStudio creates a tdms format that was not yet supported by the nilibddc dll ?

Is there any solution to this problem ? I found other topics with similar issues, but no solution !

Regards,

David
Active Participant
YongqingYe
Posts: 426
0 Kudos

Re: Read tdms files with Matlab tdm example

Hi DSA,

 

For DAQmx 9.0 generated TDMS files, they are all TDMS 2.0 verison. Please refer to this link for more information about TDMS 2.0 version:

http://zone.ni.com/devzone/cda/tut/p/id/9995#9

 

For some common TDMS 2.0 files like the 2.0 version TDMS file generated in LabVIEW, they can be converted to 1.0 in LabVIEW 2009, by using the node "TDMS Convert Format" on TDMS menu palette, but for DAQmx 9.0 generated TDMS files, it cannot be converted by "TDMS Convert Fomrat" in LabVIEW because they store DAQmx raw data in TDMS files.

 

For your problem, maybe you can try to open the file in LabVIEW 2009 to read out the DAQmx scaled data by using "TDMS Read" and then process the data.

 

Please feel free to let me know if you have any more question.

Member DSA
Member
Posts: 42
0 Kudos

Re: Read tdms files with Matlab tdm example

[ Edited ]

Thanks for your reply YongqingYe,

 

At least, I know why I can't use the Matlab example to import my tdms file.

 

I'll try to use other ways to convert my data or import them in Matlab.

 

Do you know if an other release of the nilibddc.dll is planned to support the tdms v.2 ?

 

Regards,

 

David

Message Edited by DSA on 11-30-2009 10:05 AM
Active Participant
YongqingYe
Posts: 426
0 Kudos

Re: Read tdms files with Matlab tdm example

Sorry, I don't have the idea when the release of the nilibddc.dll is planned to support the tdms v.2, but I guess it would not be too long :smileyhappy:

Member
Sappster
Posts: 178
0 Kudos

Re: Read tdms files with Matlab tdm example

Hi David,

 

I don't have specific details on the release of the TDM C DLL for version 2.0 support, but when I get it I will investigate what changes have affected the import example. I will have the documentation updated and notify you via this forum. Thanks for your patience. 

Sappster
Member
Sidhant
Posts: 3
0 Kudos

Re: Read tdms files with Matlab tdm example

Hello,

 

Ran into the same problem. Any updates on releasing an update to the dll that support v2.0 TDMS?

 

Thank you.

 

Sidhant 

Active Participant
Brandon_B
Posts: 230
0 Kudos

Re: Read tdms files with Matlab tdm example

Hello Sidhant,

 

As of now there aren't any updates for  when an update to the dll may be coming.  What you can do is use the TDMS Convert Format.vi in LabVIEW 2009 to convert it back to TDMS 1.0.  I hope this helps.

 

Regards,

Member
Sappster
Posts: 178
0 Kudos

Re: Read tdms files with Matlab tdm example

Hi Sidhant and David,

 

There isn't an updated example, as of yet. I will update this forum when there is an update. Thank you for your patience. 

Sappster
Active Participant
StefanR
Posts: 205
0 Kudos

Re: Read tdms files with Matlab tdm example

There is a new version of the MATLAB TDM example available which supports TDMS 2.0 files.

Please find the new versione here:

http://zone.ni.com/devzone/cda/epd/p/id/5957

Member
ssriram
Posts: 2
0 Kudos

Re: Read tdms files with Matlab tdm example

 

Hi.. I used the Matlab TDM example given here http://zone.ni.com/devzone/cda/epd/p/id/5957 to read a TDMS file. It read the sample tdm file correctly. But when I used the same Readfile.m, to read one of my TDMS file, it showed the following error. 
The datatype and size of the value must be defined before the value can be retrieved.

Error in ==> ReadFile at 57
    disp(['File Description: ' char(filedesc.Value)]);
Do I need to change anything in the header file or the DLL file? 

 

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page