Menu

matlab - array of strings

2023-02-22
2023-02-23
  • Øyvind Magnussen

    I'm using this to convert a .tdms-file to .mat. In the .mat-file I want to store the channel names as an array of strings. When doing this i get this error:

    matlab_write.vi:4890002<err>
    Arrays of strings unsupported</err>

    Accoring to the "Variant I/O" on this page: https://h5labview.sourceforge.io/?examples it looks like the string array is possible. I tried this conversion (string array to variant) but with no luck.

    Is StringArray possible with .mat-files?
    
     
  • Martijn Jasperse

    I think it should be possible, it's just not implemented yet. The problem is not the writing arrays of strings to H5 on the LabVIEW side, but rather the unclear specification for the MAT file definition of a string array. A string array is an "array of variable length arrays" and I think MATLAB uses a fairly complicated way to describe such nested structures - but I don't have MATLAB so I never looked into it. The MATLAB handling code was originally contributed by community members.

    One ugly solution might be numbered attributes (name1, name2, etc). Alternatively if you can define the structure of how MATLAB expects arrays of strings to stored, then matlab_write could be improved to handle this case.

    Cheers

     

Log in to post a comment.