Skip to content

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

@kevwubs

Description

@kevwubs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions