LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS Timestamp Decoding - Help!!

Hi Brad,

 

Thanks very much for providing the program. Could you suggest how to resolve the following error please? 

 

??? Invalid field name: '33P11Voltage1'.

Error in ==> convertTDMS at 121
                    ob.(obname)=[];

 

Best,

 

Wilroy 

 

0 Kudos
Message 31 of 42
(2,208 Views)
The code uses the channel names for the variable names in MATLAB.  Variables must begin with a text charateric (not numeric) in MATLAB.  That looks to be the problem.  I will see if I can come up with a fix for checking the variable name.
0 Kudos
Message 32 of 42
(2,177 Views)

Hi,

 

First thanks for your code,actually I tried to use this code for converting a tdms file,but I got this error:

 

Error using fread
Invalid precision.

Error in convertTDMS (line 174)
propsValue=fread(fid,1,matType);

 

is there any possibility to solve it?!

 

 

0 Kudos
Message 33 of 42
(1,704 Views)

Hi Navid777,

 

Have you tried changing the matType to other datatypes? The error message:

 

Invalid precision.

 

indicates that whatever "matType" is doesn't work with the function fread.

 

 

Aldo A
Applications Engineer
National Instruments
0 Kudos
Message 34 of 42
(1,676 Views)

Hi Aldo,

 

firstly thanks for your answer.

I did not change anything,as a beginner I just guess maybe it's because of the way that data has been stored in my TDMS files,when I open the files there is no channel and group,it's kind of DAQ. Actually I have tried to understand the difference between these two but was not successful!

Could this error happen because of that?

 

Best regards,

Navid

0 Kudos
Message 35 of 42
(1,658 Views)

Hi Navid,

 

From reading this thread, it seems that other people had similar issues with that function too and the cause mostly pointed to fread being unable to read in the timestamp properly.

 

If you take a look at page 2 of this thread http://forums.ni.com/t5/LabVIEW/TDMS-Timestamp-Decoding-Help/td-p/691745/page/2 the author of the script addressed the issue.

 

My recommendation is to study messages 14-17 so you can get a better understanding of the input files the script will work with.

 

Aldo A
Applications Engineer
National Instruments
Message 36 of 42
(1,636 Views)

The first 4 bytes are type code. After that each timestamp value is represented by 16 bytes. The first 8 bytes is the milliseconds, and the other 8 bytes is the number of secs since 12:00 a.m., Friday, January 1, 1904 (0:00:00.000 1904/1/1). Notice that all these bytes are represented in little-endian.

0 Kudos
Message 37 of 42
(1,616 Views)

Navid,

 

It looks like you may be OK with the timestamp issue but I saw that you still had other problems on the Mathworks site.  Are you still having problems?  If you can upload a small data file here, I might be able to trouble shoot your issue and update the function.

 

By chance, are you using tdms version 2.0 (check your tdms write block)?  If so, I don't think it is supported yet.

 

Thanks,

 

Brad

0 Kudos
Message 38 of 42
(1,609 Views)

Hi Brad,

 

Thanks for your answer.

 

Actually I don't need anymore to change the format like that,because I was goanna to manipulate some data in tdms file and I found out it's possible to do this stuff in DIAdem.

In DIAdem we can save  tdms file as a math file,but the point is, that file would be really large so I need to at first do "down sampling" and then save the new file as math file in order to use it in Matlab.

 

Best,

Navid

 

 

 

0 Kudos
Message 39 of 42
(1,588 Views)

Just a suggestion for those with big files (GB).  In my TDMS write subvi's, I build in a capability that peridically (based on elapsed time or file size), stops the file and opens a new one.  A timestamp is appened to the end of the file name.  This is good practice in general just to mitigate file corruption issues.  It also allows you to batch post process files in chuncks.

 

Message 40 of 42
(1,580 Views)