File Exchange

image thumbnail

Convert TDMS (v2)

version 1.8.0.0 (5.91 KB) by Grant Lohsen
Import a TDMS v2 file as a matlab object (ob).

5 Downloads

Updated 15 Apr 2010

View Version History

View License

Import a TDMS file as a matlab object (ob). This is based on the work by Brad Humphreys of ZIN Technologies (he supported v1 of TDMS). Only works on TDMS v1.2.

Cite As

Grant Lohsen (2020). Convert TDMS (v2) (https://www.mathworks.com/matlabcentral/fileexchange/25947-convert-tdms-v2), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (14)

Hari Patel

I tried to read .tdms file(300MB) generated by LabVIEW SignalExpress and I got following error:

10:09:05 Begining conversion of: C:\work\Matlab workspace\Signal Express data\07112012_030159_PM\convertTDMS (1)\Digital_Input.tdms
??? Error using ==> fread
Invalid precision.

Error in ==> convertTDMS at 257
propsValue=fread(fid,1,matType);

Any suggestions?

Robert

Version 7 of this function was posted 20 SEP 10 (File ID #28771)

Michael

Is anybody going to take a stab at updating this to process TDMS v 2.0 files?

Soraya

Has somebody found a way to make it work with the v1.1 format ?
It seems that there are a lot of things to change.
Thanks

John

I think this is a much better solution than the dll provided by NI. I've searched extensively and tried a few approaches and this is the closest I've found to a good solution so I really appreciate the work that has been done here. I am having problems getting it to fully work, though. I implemented fix 1 suggested by Alex above and added a few more hacks to get it to run without errors, but in the end none of the data is present in the output. I added a line to remove commas in the fixcharformatlab, and I also had to add a check after line 315 to continue the loop if cnt == 0. If you'd like I could send you my tdms file to help with debugging.

Grant Lohsen

I think the group functions may not be working properly. If you experience any problems with it let me know. I am trying to determine if there is an error in it.

Grant Lohsen

Mark,
The original file this is based off of (written by Brad Humphreys of ZIN Technologies) supported V1.0 of TDMS, mine supports V1.2. I haven't written one to support v1.1 and have not seen any documentation of the format (v1.2 has format specs online). I hard coded the version restriction so that it would only run on supported version (1.1 is 4712 and 1.2 is 4713).

I may add support for v1.1 in the future but it will be after i incorporate the upcoming v1.2 enhancements to speed and support of comment data.
-Grant

Mark Shore

Seems to work well on TDMS v1.2, but halts with an error message for TDMS files v1.1 files:

Warning: This code is designed for version 4713 of the labview TDMS format.
You are attempting to import a file from version 4712 . Aborting Now

I've tested it on relatively large (300 MB) 16-channel files, but not multisession ones yet. Will hold off on a numerical rating for now.

Alex

Still really appreciate this code!!!! Had some problems importing a cluster containing metadata stored as properties with no large sets of data attached. I'd love to submit a TDMS file for you but am unsure how in this forum.
1. Program has a few instances of:
'rawDataInThisSeg=0;'
which get get called with these zero data property entries. and therefore eliminate the array that should exist
replacing them with
'rawDataInThisSeg(obnum)=0;'
eliminates a failure at line 257, Index exceeds dimensions
and did not cause problems with rest of function.
2. Program assumed that there would be a lot of data attached and allocated a lot of memory to single value. I believe error had something to do with:
'estNumSeg=floor(filesize/(20+segLength)*1.2);' I hacked around this, making it equal to 1 for my special case, but surely there is correct method.

PS. Mathworks is currently posting the NI solution to this problem http://www.mathworks.com/support/solutions/en/data/1-2XFSRG/?solution=1-2XFSRG

Others may also wish to tell them how much better this solution is.

--Alex.

Grant Lohsen

This file is about to face a major update so comments will be supported in imports. Just FYI to check back inside of ~1-2 months (when I get time to update it)

Alex

Seems to work a lot better than code provided by NI that requires its own rather large C library and has very limited set of datatypes!

antonio Acampora

it works well. I used over more than 6000 file and it goes well.

thanks for this important file :)

antonio Acampora

Andres

I did not test convertTDMS.m extensively, but I'll give it 5 stars as it worked with my files without any problem. Thanks, Grant!

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Acknowledgements

Inspired: ConvertTDMS (v6), ConvertTDMS (v9)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!