LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get all property names of TDMS in Matlab -> segmentation fault / wrong result

I use the DLL nilibddc of the matlab_tdm_example_sp2010.zip to convert TDMS files to Matlab data.

There I get the following problems when trying to get all property names:

A) Matlab crashes
I used the function "DDC_GetFilePropertyNames" to get a list of all file-properties.
This worked fine in Matlab and deployed Matlab Application on Win-32 System.
Executing the deployed Win32 Application on Win-64 System results in an segmentation fault
if the function DDC_GetFilePropertyNames was called before (when m-function calling DDC_GetFilePropertyNames exits).

Code-snipped:
  p_numElements = libpointer('uint32Ptr',0);
  err = calllib('nilibddc', Function_GetNumProperties, handle, p_numElements);
  numProperties = p_numElements.value;
  emptycell = repmat( {''}, numProperties+5, 1 );
  p_FilePropNames = libpointer('stringPtrPtr', emptycell);
  err = calllib( 'nilibddc', Function_GetPropertyAllNames, handle, p_FilePropNames, numProperties );
  for ii=1:numProperties,
    tempPtr = p_FilePropNames + (ii-1);
    propertyNames{ii} = tempPtr.Value{1};
  end

B) wrong return values of "DDC_GetFilePropertyNameFromIndex"
I tried to use the function DDC_GetNumFileProperties, DDC_GetFilePropertyNameLengthFromIndex and DDC_GetFilePropertyNameFromIndex
instead of the above solution.
But here the fuction DDC_GetFilePropertyNameFromIndex  doesn't return the property-name (only the blank string).

Code-snipped:
  numProperties = p_numElements.value;
  for nn=1:numProperties,
    err = calllib( 'nilibddc', Function_GetPropertyNameLengthFromIndex, handle, nn-1, p_numElements );
    nameLength = p_numElements.value;
    p_propertyName = libpointer('cstring', blanks(nameLength+1));
    err = calllib( 'nilibddc', Function_GetPropertyNameFromIndex, handle, nn-1, p_propertyName, nameLength );
    propertyNames{nn} = p_propertyName.Value;
  end

0 Kudos
Message 1 of 2
(2,705 Views)

To make it more precise:

A) worked fine with Win XP 32bit and has problems with Win 7 64bit and (!) 32bit.

B) works neither on Win XP nor Win 7.

0 Kudos
Message 2 of 2
(2,678 Views)