LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read strings from tdms files using matlab

Hello everyone!

 

I am trying to read tdms files with Matlab. I have downloaded the matlab tdm example and i am able to retrieve DBL values but i can't read string data.

I have attached a test tdms file with strings. Can you please tell me how I could read it?

Thank you very much!

0 Kudos
Message 1 of 4
(2,495 Views)

Hi,

 

Text channels in TDM and TDMS files cannot be read in MATLAB®.

You would have to convert the TDMS file to some other format (such as ASCII) and then import it into Matlab.

 

Regards,

Joseph

0 Kudos
Message 2 of 4
(2,450 Views)

Joseph,

 

Is there a fundamental reason why text channels cannot be read or has it just not been implemented in the Matlab code? I've been trying to get the following function from the library working,

 

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

 

I haven't had any luck yet, but I'm not used to calling DLLs from Matlab so I am likely making coding mistakes.

 

Thanks,

 

Erik

0 Kudos
Message 3 of 4
(2,269 Views)

Hi Larson,

Did you ever find a solution to this?

 

I have have been able to use this function with the following code

 

% Get the number of available values
[eCode,nValues] = calllib(libname,'DDC_GetNumDataValues',hChannel,iTemp);
iStart = 0;

% Get the string values
iTemp = libpointer('stringPtrPtr',repmat({''},1,nValues));
[eCode,dValues] = calllib(libname,'DDC_GetDataValuesString',hChannel,iStart,nValues,iTemp);

However, the variable iTemp needs its memory deallocated using the TDMS function 'DDC_FreeMemory' otherwise matlab crashes. 

So far, I have been unable to sucessfully deallocate the memory after reading the string values. 

 

 

0 Kudos
Message 4 of 4
(2,164 Views)