LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDMS Timestamp Decoding - Help!!

hello,I run your code,but some error occur:

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

Error in ==> convertTDMS at 218
                    ssamples=ob.(cname).nsamples;

 

what is the problem? I run the code under matalab r14

thank you

0 Kudos
Message 11 of 42
(3,553 Views)

Hi!

First of all I just want to tank you for the code you attached. I have TDMS files with measurement data and corresponding time stamps for each sample and want to import this data to Matlab. Basically the same thing as you want to do, I suppose? I tried your attached code and got the following message:

??? Error using ==> fread
Invalid precision.

Error in ==> convertTDMS at 215
                    [data cnt]=fread(fid,nvals,LV2MatlabDataType(index.dataType(r)));

 

What does "invalid precision" mean here and how can I correct this? Gratetful for any help! /J

0 Kudos
Message 12 of 42
(3,478 Views)

Ibir, Josefin,

Would it be possible for you to upload a small tdms data file that you are using?   I believe (espically in Josefin's case) that this is just an issue with decoding a datatype. 

Regards,

Bradh

 

0 Kudos
Message 13 of 42
(3,469 Views)
Absolutely! Here is a file with streamed data where the sample timestamps are stored under ther group name "Time" and measurements stored under the "Data Ch: 1"-group. Changed the file extension to txt from tdms just to be able to upload it. Hope that it works when you change it back to tdms.

It would be absolutely great if you can help me find what is wrong here! Cos it really would make my life a whole lot easier if this could be solved with a matlab script like that. 🙂 Thanks for helping me out! /J
0 Kudos
Message 14 of 42
(3,456 Views)

Had a chance to look at it, and it seems to be a problem interpreting the time stamp.  We figured this out when the timestamp was in the meta data, but when it is written as a channel as you have done, it seems to be causing a compatibilty issue.  I have a couple of fires burning right now.  Will be looking at it later today/tomorrow.

 

NI folks - Can you provide more information than what is in:

 
0 Kudos
Message 15 of 42
(3,429 Views)
Hi bradh,
 
I can try to provide more information, but you will have to be a little more specific as to what additional information you are looking for.
 
This article specifically addresses the issue of "Reading TDM/TDMS Files with The MathWorks, Inc. MATLAB® Software".  There's also an example.
 
I hope this helps,
Kevin S.
Applications Engineer
National Instruments
0 Kudos
Message 16 of 42
(3,406 Views)
Sorry for the delay.  I found the problem and believe I have fixed it.  See the attached m file (you will need to change the extention back to ".m").  Please let me know if you experience any other problems or have any feedback as I would like to perfect this. 


Kevin S. - As mentioned previously in this thread, the problem with the page you linked is that it is a compiled non-open c dll.  Therefore when software versions change, we are all stuck until NI catches up.  Honestly, I have never been able to get it to work either.  That is why I went to the NI page that I linked to.  The information there is incomplete/vague/ambigous (time stamp is not properly defined for decoding, the version number is not properly defined for decoding, it is unclear as to when data objects may or may not show up, etc.). 

Some of the nice things about the .tdms format is its stability, size, speed, self documenting.  It is currently our "standard" collection format in our labratory.  As we deciminate this data to non-Labview users we have to provide reliable means for them to utilize the format (or I start getting requests to write data in flat binary or even worse ASCII!).  I keep getting back the "use diadem"; it is highly impractical for me to go to our data users that utilize MATLAB and say if you want to use our data, you need to buy this software and go get trained or go buy it just to use it's data plugin to convert files 

0 Kudos
Message 17 of 42
(3,333 Views)

bradh,

 

I've used your convertor, and it is working, thanks! But there's a little problem: the data arrays don't get bigger than 1080000 and I'm losing data... any idea on how to fix that? As I'm acquiring on 2.5MHz for about 5 seconds, I would need something arround 12x10^6 arrays, and not 1.8x10^6... I've tested and Matlab does support that size...

0 Kudos
Message 18 of 42
(3,147 Views)

Danigno,

 

Couple of questions: 

 

1) I understand that you are not reciving any error messages; the script runs, but you know that data is missing.  Is this true?

2) Do you know where the data is missing from?  Is it itntermittant loss, or are the arrays truncated (just missing begining or ending sections)?

 

 

Regards,

 

Brad

0 Kudos
Message 19 of 42
(3,116 Views)

Hi Brad, thx for the promt answer! I didn't think it would be that fast! 🙂

So, I think I found the problem at my program, when I'm still acquiring the data from LabView. I haven't solved it yet, but I don't think it is your program's problem anymore.

 

Well, now that you've already come here, the number I get from the timestamps... aer they in DAYs units?

 

Thanks a lot for your program, it is really helping me here!

Rafael

 

0 Kudos
Message 20 of 42
(3,091 Views)