Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Open TDMS in Matlab

Hello, I acquired data to TDMS file and now I need to open TDMS File in Matlab, how can I do it?  Can you tell me, how structure has the file? Or exists some library for Measurement Studio?Thank you for your answer Monika
0 Kudos
Message 1 of 10
(12,428 Views)
Monika,

I'm slightly confused. You said you want to open the file in Matlab, but how does Measurement Studio come into this? Did you acquire the data with LabVIEW? Also, the TDMS file is simply a binary file, so all of the data is in binary xml format, so in Matlab you would need to tell it how to read this. Are you using Measurement Studio or are you using Matlab? That is the main question we need the answer for.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 2 of 10
(12,408 Views)
Hi, I´m very sorry I didn´t explain it enough. I would like to use only Matlab. My head of my diploma work said if it´s impossible to read in Matlab I need Measurement Studio (but I´ve never worked with it). Believe me I would like to use LabVIEW for readining data from TDMS, but it ´s not possible for my next task 😞 Monika

Message Edited by Moni on 11-06-2006 09:54 AM

0 Kudos
Message 3 of 10
(12,388 Views)
Hi Monika,
 
TDMS is a data format based on the TDM format. The TDM format is an XML format with embedded binary (when saved as binary) and you can find more info about it here. TDMS has some subtle differences discussed in this article. This article focuses on using LabVIEW VIs with TDMS; however, the concepts of TDMS files are all there.
 
While we do not have any public tools for parsing a TDMS file in Matlab, you should be able to write a TDMS reader for Matlab without too much difficulty.
 
I have provided a few more links that may be helpful for you as well.
 
 
 
Matt M.
National Instruments
 
 
0 Kudos
Message 4 of 10
(12,371 Views)
Thank you. It could help, Monika
0 Kudos
Message 5 of 10
(12,328 Views)

I assume that you acquied  data with NI DAQ hardware using LabVIEW is that right,

after that you wrote your measurements in TDMS file?

So you want to open this fail in Matlab for future procesing of this data?

If this is true there is solution for you.

The TDM data file format of National Instruments is portable to other applications such as Excel.

After porting the data to .xml or .xls file, you have to use xlsread, xlswrite functions

The syntax is:

DoMnode = xmlread(filename) reads a url or filename

and returns a document object model node responding to the doc.

But basicly I don`t understand why you want to use Matlab for this application,

when NI provide more reliable and the most important - much more faster solution.

0 Kudos
Message 6 of 10
(12,319 Views)
Ivo V,
 
Is there another way to convert TDMS files to XML without using Excel?  My data set exceeds the limitations of Excel or the TDM importer provided by NI.  Is there a tool in Matlab that will alow me to read TDMS files directly?
 
VR
Marvin
 
0 Kudos
Message 7 of 10
(12,140 Views)
Monika,

NI currently does not provide any reader for either the (new, binary) TDMS format, nor the (legacy, XML+binary) TDM format that wouldn't require either Excel, DIAdem, LabVIEW or LabWindows/CVI. A viable solution for reading TDMS into MatLab would be to compile a DLL in LabVIEW or CVI that reads the file and exports functions that make the results you need available. MatLab could then call this DLL.
TDMS is the file format NI recommends for measured data storage - for a variety of reasons. However, if you need to import your data into an application that doesn't support TDMS, there are other reasonable choices like spreadsheet or binary files. Did you consider using any of these formats? If so, what were your reasons to go with TDMS?

Marvin,

if your dataset is too big for Excel, you might also have problems with whatever XML engine you use to read it. XML is tag based and character-based, that is a deadly combination when it comes to performance ... but if your computer has enough fire power, go for it.
I wouldn't know that such a tool exists. If you need to implement something like that, you might be able to reuse some of the code we wrote for the TDMS<->TDM converter VIs. These VIs are on the Storage palette and they reside in vi.lib\utility\tdmsutil.llb.

Hope that helps,
Herbert
0 Kudos
Message 8 of 10
(12,128 Views)

Hi Herbert,

Is there something for LabWindows/CVI?  -Marvin

0 Kudos
Message 9 of 10
(12,127 Views)
Yes. Here's the overview. Here's the details.

Herbert
0 Kudos
Message 10 of 10
(12,108 Views)