I am trying to create a file to be read in a matlab enviroment. The structure in matlab looks like this
trx(1) =
x: [1×1500 double]
y: [
In Octave
M =
scalar structure containing the fields:
x =
1 2 3 4
y =
5 6 7 8
one = 1
two =
1 2
>> save -7 struct.mat M
In Ipython:
In [450]: dat = io.loadmat('struct.mat')
In [451]: dat
Out[451]:
{'__header__': b'MATLAB 5.0 MAT-file, written by Octave 4.2.2, 2019-02-08 18:49:49 UTC',
'__version__': '1.0',
'__globals__': [],
'M': array([[(array([[1., 2., 3., 4.]]), array([[5., 6., 7., 8.]]), array([[1.]]), array([[1., 2.]]))]],
dtype=[('x', 'O'), ('y', 'O'), ('one', 'O'), ('two', 'O')])}
Here M
is (1,1) structured array, with all fields being object
dtype. That way they can each have their own shape. The scalar is a (1,1) matrix.