Reading a mat-file whichs includes a table variable

Hallo,

I try to read mat file (generated by Matlab).

I tried loadmatfile and matfile_open.

It seems to me, that all variables are read before a table variable is reached.

e.g.:

data = loadmatfile(inPath, "-toStruct");

does work, and no error values/messages are returned.

However, data contains only variables which are stored before the “table-type variable”.
Variables that follow the “table-variable” are not read.

Checking the Scilab result with matfile_listvar I would like to get a confirmation if loadmatfile and /or `matfile_open’ do not support a Matlab - table variable.

Scanning the file with matfile_varreadnext I am able to read also variables “following” the “table-variable”. Does loadmatfile simply stop reading from a mat file when they can not read a variable?

Thank you,
Philipp

Hello,

Scilab depends on matio library, which supports the following types:

To save a table in Matlab and read it back in Scilab in would suggest to convert it first to a struct, e.g. (Matlab side):

t=table([1;2;3],[4;5;6])
ts=table2struct(t);
save ts.mat ts

then in Scilab:

loadmatfile ts.mat
t=struct2table(ts)

 t = [3x2 table]

   Var1   Var2
   ____   ____
              
   1      4   
   2      5   
   3      6   

S.

2 Likes