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.
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
Error in ==> convertTDMS at 257
Version 7 of this function was posted 20 SEP 10 (File ID #28771)
Is anybody going to take a stab at updating this to process TDMS v 2.0 files?
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.
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.
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.
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.
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.
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:
which get get called with these zero data property entries. and therefore eliminate the array that should exist
replacing them with
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.
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)
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!
it works well. I used over more than 6000 file and it goes well.
thanks for this important file :)
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!
New in version 1.4
Warns user and aborts TDMS import if the TDMS file is a version other than that which this script supports.
Needed to actually put my name in file with updated version information.