Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

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
0 Kudos
Message 1 of 32
(11,932 Views)

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.

0 Kudos
Message 2 of 32
(11,889 Views)

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
0 Kudos
Message 3 of 32
(11,882 Views)

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 🙂

0 Kudos
Message 4 of 32
(11,858 Views)

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
0 Kudos
Message 5 of 32
(11,838 Views)

Hello,

 

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

 

Thank you.

 

Sidhant 

0 Kudos
Message 6 of 32
(11,186 Views)

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,

0 Kudos
Message 7 of 32
(11,137 Views)

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
0 Kudos
Message 8 of 32
(11,133 Views)

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

0 Kudos
Message 9 of 32
(10,603 Views)

 

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? 

 

0 Kudos
Message 10 of 32
(9,723 Views)