LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get tdms Channel names in matlab

I think the problem is the unsupported data type of the time stamp in the TDMS file.
Generally, the properties are stored different in the tdms, therefore all properties are unavailable (please check this with the following syntax: [error] = calllib (.....))
The usiDLL which is used to extract the information is especially used for TDM only. Probably Herbert can say something more on this...

For now the workarounds are:
a) If you have already gathered TDMS files with timestamps, use the conversion VI "Convert TDMS 2 TDM.vi". In this case all properties and also the time channel is available with the previous posted code and you might also create an executable with an enabled ActiveX server wich provides the option to run an ActiveX script in Matlab to automate the conversion process.
b) If you want to use TDMS again, store the timestamp as DBL value (simply convert the timestamp with the conversion function "to double precision float") and add it as channel. In this case you need to be aware of the number of samples to write...
c) Add the time information to the file name
d) Make TDM to your default format but in this case you loose all the advantages TDMS provides: http://zone.ni.com/devzone/cda/tut/p/id/3539

ThSa


Message Edited by ThSa on 01-24-2008 07:54 PM
0 Kudos
Message 21 of 47
(2,802 Views)

Thanks ThSa,

 

the calllib really does return an error on the TDMS files when asking for the minvalue and maxvalue, returning error -6214 which is DDC_PropertyDoesNotContainData

I am writing with the "DAQ Assistant" module connected straight to the "Write To Measurement File" module, with a switch for the "enable" input on the latter module. Can you give me a hint where to change the format of the timestamp you suggested?

 

Thanks dearly,

 

WildCherry

0 Kudos
Message 22 of 47
(2,791 Views)
Attached please find an example (8.2) with an additional channel which is simulating "timestamp".
It's not the best way for the memory, but it is working...
For analysis you do have directly the correct relative timestamp in the TDMS file as tje first channel which does make it unnecessary to compute it by using min and max values.

ThSa
0 Kudos
Message 23 of 47
(2,778 Views)

ThSa, Thanks dearly for all your help! I will try it out in the beginning of next week,

Cheers,

Michael

0 Kudos
Message 24 of 47
(2,758 Views)

Dear ThSa,

 

Regarding the timestamp data on TDMS, do you know when/how they will be able to be read by the nilibddc library? Does the problem currenly reside there you believe??

 

Gratefully yours,

 

WildCherry

0 Kudos
Message 25 of 47
(2,733 Views)
The problem resides in the MatLab Adaptor for TDMS. The TDMS file format and its API in LabVIEW do support timestamp properties, but these cannot be read in MatLab or DIAdem. Unfortunately, I cannot give you a time line for a fix at this point. I know it's not a great solution, but maybe your best bet for now is using a string property that contains the timestamp.

Herbert
0 Kudos
Message 26 of 47
(2,718 Views)

ThSa:

Did you ever find what causes this error?

Thanks

0 Kudos
Message 27 of 47
(2,707 Views)

Sunitha:

Did you find a work around to the error:

No appropriate method or public field Value for class handle

Thanks

Joe

0 Kudos
Message 28 of 47
(2,706 Views)


COsiecki wrote:
I'm having a similar problem. Although I can get the channel names to work right, I am unable to get DCC_GetFilePropertyNames to work. I have all the libpointers set, I think, but I either get a segmentation fault and Matlab crashes, or it seems to work fine, but no values were output. Here's what I've done:

Once I open the file and get the file handle using the loadTDM.m sample, I create a pointer to a cell array of strings

pstrings = libpointer('stringPtrPtr',{'','','',''});

I have tried it without making the empty strings, but it crashes every time. That there are 4 strings is only because in this instance, there are 4 properties. I can read the number of properties and scale that appropriately.
Then I try to read the names

calllib ('nilibddc','DDC_GetFilePropertyNames', pfile.Value, pstrings, 4);

Supposing it crash, if I then look at pstrings.value, I get
''
''
''
''

Can anyone see what I'm missing? All help is appreciated.


I encountered the same problem, which I got round as follows. If you check the syntax for the commands in the nilibddc library (when you have loaded it) - as follows:

libfunctions(

'nilibddc', '-full' )

- you get the following result for the DCC_GetFilePropertyNames function:

[int32, stringPtrPtr] DDC_GetFilePropertyNames(int32, stringPtrPtr, uint32)

In other words, you can get the names via the output argument (in this case as a cell array of strngs). Here's my code:

emptycell = repmat( {

''}, double(pNumFileProps.Value), 1 );

[ status, FilePropNames ] = calllib(

'nilibddc', 'DDC_GetFilePropertyNames', pfile.Value, emptycell, pNumFileProps.Value );

The same method works with DDC_GetChannelGroupPropertyNames and DDC_GetChannelPropertyNames.

BUT - and it's a big BUT - I get repeated, randomly occurring segmentation errors when I run this code. Anyone got a solution for this one?

Thanks,

Alex

The views expressed in this post are those of the originator and do not necessarily represent the views of NPL Management Ltd. Nothing in this post shall bind NPL Management Ltd in any contract or obligation.

 

The views expressed in this site are those of the originator and do not necessarily represent the views of NPL Management Ltd. Nothing in this post shall bind NPL Management Ltd in any contract or obligation.
0 Kudos
Message 29 of 47
(2,593 Views)
Hi,

I can't even seem to find the Matlab example for reading TDMS files. I've looked at

http://digital.ni.com/public.nsf/websearch/0EEADA99DC7D00A4862572E30037C3A2?opendocument&Submitted&&node=133020_US

where nilibddc_m.h and  loadTDM.m  are mentioned. The ZIP-file in

http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/0eeada99dc7d00a4862572e30037c3a2/$FILE/MatLab%20TDM%20Example.zip

however does NOT contain these files! It contains nothing Matlab-specific, so I guess it's actually the wrong file.

I would be very grateful if someone could please upload a correct "Matlab TDM Example.zip" file to this forum or to the above NI Knowledgebase article?


0 Kudos
Message 30 of 47
(2,440 Views)