Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Can Matlab be used to read TDM (technical data management) files?

We are considering using TDM storage vi's to save data acquired by a Compressor Monitoring System. Many channels will be scanned, some at a relatively high rate (>5 kHz) for many hours resulting in a large data set. We would like to use Matlab to post-process some of this data. We know that an add-in exists for Excel. Does one exist for Matlab? If not, is it possible to write a simple Matlab function that can read the header file and the binary data?
0 Kudos
Message 1 of 18
(6,584 Views)

Hey psp guy!

I am not sure if it is possible to write a MATLAB function that could translate a TDM file.  What post processing do you need to do in MATLAB?  LabVIEW 8 added a ton of new analysis functions that you could probably use to process your data set.  Also added is MathScript which you may find useful.  LabVIEW does have a toolkit called the Math Interface Toolkit that does allow interfacing with MATLAB.  Since the TDM file has built in support in LabVIEW, it will probably be easier to program in just LabVIEW. 

Please repost if you have any other questions!
Andy F.

 
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 2 of 18
(6,567 Views)
 

Hi Andy,

Thanks for the reply. I realize that most post-processing can be done easily with LabVIEW  but there are many here who use Matlab and don't know LabVIEW. I'm anticipating a lot of resistance when I propose a file format that can be read exclusively by LabVIEW. I will check out MathScipt  and the Math Interface Toolkit ; hopefully it will help me convince them TDM is the way to go!

PSP Guy

0 Kudos
Message 3 of 18
(6,560 Views)
I saw that you had another post here that has a slightly different answer about MATLAB and TDMs.  Here is that link.

Andy F.
-----------------------------------------------------------------
National Instruments
0 Kudos
Message 4 of 18
(6,540 Views)
 
Now there is a knowledgebase article describing in detail how to import TDM and TDMS files into MATLAB from the Mathworks Software.
 
ThomAC
 
0 Kudos
Message 5 of 18
(6,306 Views)

Ok, so *theoretically*, one can read TDMS file information into Matlab.  But I'll be darned if I can figure out what I need from the linked knowledgebase example, which is far too rudimentary.  It only reads the channel's data values, but it does *not* identify any of the channels by name.  It also doesn't demonstrate how one would extract any of of the file, group, or channel property info, without which a bunch of unidentified and unlabeled data is fairly useless.

Hasn't anyone at NI worked up a more illustrative and universal example?  Under LabVIEW, the TDMS file viewer gives us a quick way to inspect the entire contents of any TDMS output files.  It was a great point of reference when I developed custom vi's for reading my own particular files.

Does anyone have a comparable example in Matlab, capable of reading all the info from a TDMS file and saving it to appropriate variables?  At the moment, I can't even figure out how to use the Matlab pointer datatypes to read channel names and create named variables for the TDMS channel data I read in.

Gripe:  TDMS has gotten quite a bit of promotion as a preferred file format for LabVIEW data storage.  I really like it for writing, but am on the verge of abandoning it because it's been too cumbersome to work with after the fact.  There's a woeful shortage of useful tools available for manipulating TDMS files, especially outside of LabVIEW or (presumably) Diadem.  I suppose the Excel plugin might be kinda useful IF we had the right version of Excel AND we had IT privileges for installing plugins AND Excel weren't so dog-slow with 10's of MB of data. 

What I *want* to do is create test apps that produce lots of data that our analysts can play around with to their hearts' content.  That means they need to be able to handle the data format.  Realistically, this means converting data into Matlab.  That's where they play -- it's the tool they're proficient with and have a group license for.  Diadem ain't gonna happen.  I can't make a LabVIEW executable or dll b/c we don't have install privileges (for the needed LV run-time) on our networked workstations.  So unless I can come up with a Matlab script that brings in all the relevant info from my TDMS files, I'll be the bottleneck on all the analysis work, since I'll be the only one able to convert them into a more useful format.

NI, if you want to make a file format standard and ubiquitous, give us the tools that make it stop hurting so much!

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 6 of 18
(6,129 Views)

Hi Kevin,

in the attached m-file you can find example code to read the file (root) name property as well as the group and the channel name property.

Please let me know if you need additional infromation.

 

Greetings from cloudy Aachen

Stefan

 

0 Kudos
Message 7 of 18
(6,111 Views)

Thanks for the example -- it does read in group and channel names for me and I'm digging through Matlab help to better understand their pointers and handles so I can actually understand what to modify.

The kind of additional information I mainly need is Matlab orientation.  For example, when I want to retrieve a channel's 'Name' property, the dll help file refers to the argument as a "void *".  Your example successfully uses the datatype "uint8Ptr" instead of "voidPtr".  I had previously tried passing in a voidPtr without success (though I may have had something else wrong too). 

It also isn't clear when declaring a Matlab libpointer whether I should give a scalar length like 32 or a range value like 1:32.  Does the latter create an array of pointers, i.e., does it effectively become a pointer to a pointer?

I realize it isn't NI's job to give Matlab help, but a more thorough example and a small doc that gave a *little* explanation for the syntax would be a big help. 

Please feel free to pass this along to someone who may be in a position to upgrade the example.  Meanwhile, thanks for shedding some light on it!

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 8 of 18
(6,087 Views)
Thanks for the channel name demo. I was wondering where/how can I read the recording time (hour/minutes/sec/milli/microsec) from the TDMS file via the DLL/provided script.
 
Any clue will be great,
 
Merry Christmas and Great new Year!!
 
 
 
 
0 Kudos
Message 9 of 18
(5,769 Views)

With the current version of the TDM-C-DLL it is not possible to extract date/time information from a TDM(S) file.

Happy New Years from winterly Aachen

Stefan

0 Kudos
Message 10 of 18
(5,733 Views)