ConvertTDMS icon indicating copy to clipboard operation
ConvertTDMS copied to clipboard

Function crashes on getData() when StrOffsetArray makes a negative StrLength

Open kevwubs opened this issue 1 year ago • 0 comments

We're trying to use this TDMSread function to load automotive test fixture data. I log a number of CANbusses' raw frames and some additional data into a TDMS file. I then make a converted CAN file in LabView by copying, converting and deleting the frames data. However MATLAB fails to load this file. I believe I've narrowed down the root cause to be that when data is deleted from the groups the StrOffsetArray returns some decreasing values which causes a negative StrLength which crashes the script.

I was wondering if abs(StrLength) value in line 1176 would make more sense, or am I missing something that would cause other issues ? I tried it and it did seem to then complete the conversion. I haven't been able to think or verify other scenarios, but perhaps others who understand the script better could review ? data{1,dcnt+(mm-1)*nvals}=char(convertToText(fread(fid,abs(StrLength),'uint8=>char','l'))');

Image

Image

kevwubs avatar May 05 '25 20:05 kevwubs