Code covered by the BSD License  

Highlights from
ConvertTDMS (v6)

4.5

4.5 | 2 ratings Rate this file 27 Downloads (last 30 days) File Size: 8.33 KB File ID: #28478

ConvertTDMS (v6)

by Robert

 

13 Aug 2010 (Updated 01 Sep 2010)

Import a LabView TDMS file into the MATLAB workspace.

| Watch this File

File Information
Description

Import a LabView TDMS file (version 1.1 or 1.2 with fragmented or defragmented data) into the MATLAB workspace with the option to save the data in a MAT file. It was written in MATLAB 2010a, but also tested successfully in 2007b. This function is based on the work by Brad Humphreys of ZIN Technologies and Grant Lohsen & Jeff Sitterle of GTRI; they created versions 1 through 4 of this function.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Convert TDMS (v2)

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (16)
18 Aug 2010 Sage Hahn

seem to have a similar issue as addressed in v5

Converting 'Job_Initial.tdms'...??? Invalid field name: 'OTP_Acceleration_mms^2'.

Error in ==> convertTDMS at 447
ob.(obname).(propsName)=propsValue;

19 Aug 2010 Robert

The update file I posted 19 Aug 10 fixes the error encountered by Sage Hahn. The "^" character is what caused the error. Since the channel names get transformed into MATLAB variable names, any character that is not a valid character for a MATLAB variable name will cause the same error. For the most part, the invalid characters either get deleted or replaced with "_" when the MATLAB variable is created. At some point in time, I plan to add a more robust variable name generation algorithm.

20 Aug 2010 ying

Hi Robert,
I'm new to all this , but I am getting the message error using your convertTDMS.m v6 "segment 2 withing "filename.tdms" has interleaved data which is not supported with this function (convert TDMS.m) .

Do you know if there is a TDMS to TDMS converter that solves this error ?

thanks for the help in advance

Ying

20 Aug 2010 Robert

Hi Ying,

I have never attempted to process TDMS files with interleaved data. Accordingly, I error-trapped the "convertTDMS.m" function for interleaved data files because I have never tested it with that type of data file. It is my understanding that interleaved data is seldom used because of the high processor speeds in today's computers. I don't know if someone else has written a MATLAB function that can process interleaved data.

Sorry,

Robert

20 Aug 2010 Sage Hahn

Much appreciated !

26 Aug 2010 Lawrence

Hi Robert, I've been unsuccessful in trouble shooting a field name error that keeps popping up [using ConvertTDMS (v6)].

Converting 'Acceleration.tdms'...??? Invalid field name: '03232010_124714_PM__Acceleration__All_Data'.

Error in ==> convertTDMS at 370
ob.(obname)=[]; %Create a blank version of the object

 I was wondering if you could help me out. Thanks!
Lawrence

27 Aug 2010 Robert

The updated file I posted 27 AUG 10 should fix the error that Lawrence encountered. I believe it happened because the first character in the field name was not a letter (a requirement for MATLAB variables and field names). The error trap I added for this will place an "a" in front of the field name. This new feature has not been tested because I don't have a data file to do so.

28 Aug 2010 Lawrence

I'm unable to see the 27 AUG 10 updated file (it still shows the 19 Aug 10 one).

30 Aug 2010 Robert

Sorry Lawrence... I submitted it Friday afternoon and I ASSUMED that TMW would have posted it by now. I'm not sure what's taking so long. If it doesn't show-up today, I'll submit it again.

30 Aug 2010 Lawrence

The file now shows and I was able to download the 27 AUG 10 update. I am now getting....

1) several truncation messages: Field name 'OLDNAME' is too long and has been truncated to 'NEWNAME'

2) and then this error:

??? Attempt to reference field of non-structure array.

Error in ==> convertTDMS at 449
cnt=ob.(obname).(propsName).cnt+1;

Thanks again for your help Robert!

31 Aug 2010 Robert

Hi Lawrence,

Can you please send me one of your data files that trips these errors? I don't have any with excessively long channel names to use for debugging.

Thanks,

Robert

01 Sep 2010 Robert

The updated file I submitted 1 SEP 10 should fix the second error that Lawrence encountered. The 27 AUG 10 file fixed the "invalid field name" error which allowed the function to run to the point where it encountered the second error ("reference field of non-structure array"). I was able to test the function with the data file that Lawrence sent me.

02 Sep 2010 Lawrence

Works perfectly now!

21 Sep 2010 Chris

Hi Robert,

 I am receiving this error:

>> convertTDMS(0)

Converting 'Voltage.tdms'...??? Reference to non-existent field 'NI_UnitDescription'.

Error in ==> convertTDMS>postProcess at 716
DataStructure.MeasuredData(cntData).Units_Decription=char(ob.(cname).NI_UnitDescription.value)';
                    
Error in ==> convertTDMS at 637
ConvertedData(fnum).Data=postProcess(ob);

Any ideas on how to fix it?

22 Sep 2010 Robert

Hi Chris,

I posted "Version 7" of the file on 20 SEP 10. I just updated the file (File ID #28771) with one that I think will fix your issue so, you should download that one. However, since I don't have a TDMS sample file that contains waveform data, I can't test it. Hopefully it works for you.

Robert

30 Sep 2010 callisto genco

Hi,

I have download the converter ver 1.6. It looks like everything is ok but the script can still show errors.
I had the unit error at the lines:
DataStructure.MeasuredData(cntData).Units_Decription=char(ob.(cname).NI_UnitDescription.value)';
DataStructure.MeasuredData(cntData).Unit_String=char(ob.(cname).unit_string.value)';
that I solved commenting .... with %
I have further another problem:

I have the software Signal Express version 2.5 in french. It has generated files:
Déformation.tdms_index
Déformation.tdms

with the french "é". It gives me the field error "A valid file name could not be created". I changed the tdms datafile in Deformation and I get the same error. I know I can change the file name in the sgnal express software for the next time. Unfortunately I have already generated the sata and it looks like the file name in inside the tdms file as well.
Is there any solution for these problems ?

I actually use the version 1.6.

regards
Callisto Genco
callisto.genco@delphi.com

Please login to add a comment or rating.
Updates
19 Aug 2010

This update fixes the error encountered by Sage Hahn.

27 Aug 2010

This update should fix the error encountered by Lawrence.

01 Sep 2010

Import a LabView TDMS file into the MATLAB workspace.

Tag Activity for this File
Tag Applied By Date/Time
borgwarner Robert 13 Aug 2010 16:00:18
convert Robert 13 Aug 2010 16:00:19
tdms Robert 13 Aug 2010 16:00:19
seltzer Robert 13 Aug 2010 16:00:19
tdms Massimo 20 Jun 2011 12:36:52

Contact us at files@mathworks.com