LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS Timestamp Decoding - Help!!

I'm trying to understand your converter: does it lose precision on the timestamps (I need microseconds)? Because it seems that there are groups of samples having the same timestamp...

0 Kudos
Message 21 of 42
(3,280 Views)

I have looked through the .m script and each (waveform channel) has a 'Waveform x-step widht' property which defines the dT for the channel.

I think you should use that to plot the data.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 22 of 42
(3,273 Views)

Ton, I'm not very good in .m script... can you tell me specifically where is this property?

Thanks,

Rafael

0 Kudos
Message 23 of 42
(3,265 Views)

The timestamp in the files are MATLAB's native format (# of days since Jan 1 0000).  for an explination in MATLAB, type "help datestr".  Unfortunatly, this is does cause some precision issues when going down to microseconds.  If you are working in microseconds, I am guessing that you don't care about the date, just the elapsed time.

 

I agree - the best fix, is to just use the first time in the record and then add the sample rate for each sample.   If your channel name is "force" and you want to create a time vector in MATLAB:  

 

dt=force.wf_increment.value(1);  %Get the sample time

nsamp=force.nsamp;                   %Number od sample

t=[0:1:nsamp-1]*dt;                       %Create time array

 

Regards,

 

Brad

 

 

0 Kudos
Message 24 of 42
(3,237 Views)

Brad,

 

I want to make a change in your code... I don't think it is hard, but I'm not being able to get there... I need to get only one channel at each time I convert from LV to Matlab, so it doesn't create as many arrays as it would with 8 channels, and the problem with memory (that I'm having now) stops.

Where and What should I change into your code so I can get only one channel (and its timestamps) at each use?

 

Thanks,

Rafael

0 Kudos
Message 25 of 42
(3,215 Views)

I read through this thread and never found an answer to the original question - what format is the timestamp. The answer is that it is a 128-bit fixed point number corresponding to the number of seconds since midnight, Jan 1, 1904 GMT. The first 64 bits are the integer part, the last 64 bits are the fraction. This gives resolution on the order of 5 x 10-20s. I know this is late, but I hope it helps.

0 Kudos
Message 26 of 42
(3,207 Views)

DFGray - Thanks.  MAtt K had also supplied an answer to the orginal question, but thanks for lending a hand too.  I think this has morphed into getting a good solution to reading TDMS into MATLAB.

 

Rafael,

 

I would add an input argument to the .m function where the name of the desired object is supplied.  Then there would be an "if" struicture added to the code that would ignore all other objects except for the desired object.  It might even make since to have a whole seperate function that just gets the index out of the file (it contains the name of all the objects).  I have a bunch of fires burning right now or I would bite this off.  When I get a chance I will see if I can add it.

 

Regards,

 

Brad 

0 Kudos
Message 27 of 42
(3,194 Views)

Hi Brad,

 

thanks for the answer. I was thinking about doing this already, the problem is that I don't know where to put the 'if' strucutre in the .m file... I tried some places but couldn't find the right one. Could you tell me where in the code should I add it?

 

Thanks,

Rafael

0 Kudos
Message 28 of 42
(3,164 Views)

Hi Brad,

I was directed to your Matlab script after posting a message about reading TDMS files on a Mac.  I can't read the .dll files, so it would be great if I could just use a script.

I downloaded your code and tried to run it, but got this error message:

17:24:57 Begining conversion of:  /Applications/MATLAB75/work/Or22c/2-methylpyrazine2_rep1.tdms
??? Error using ==> convertTDMS at 74
Unexpected bit stream in file: /Applications/MATLAB75/work/Or22c/2-methylpyrazine2_rep1.tdms  at segment 2 (dec: 4 0 0 0)
I'm not great with Matlab, so I can't figure out what it is about my file format that can't be read by the script.  Do you have any recommendations for modifications I could/should try? 

I record two channels, the first one has a spike train, the second one has a voltage step (trigger), and the file should be roughly 30 seconds long.  I don't belive I have any special formatting within the file, just the two channels.

Thanks!

 

-Shelby

0 Kudos
Message 29 of 42
(3,048 Views)

Shelby -

 

Sorry to be VERY slow in my reponse.  I have made some changes to the conveter which may address your problem.  If you are still looking for it, let me know and I can post it.

 

 

0 Kudos
Message 30 of 42
(2,776 Views)