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: [1×1500 double]
a: [1×1500 double]
b: [1×1500 double]
theta: [1×1500 double]
firstframe: 1
endframe: 1500
nframes: 1500
off: 0
trx(2) =
x: [1×751 double]
y: [1×751 double]
a: [1×751 double]
b: [1×751 double]
theta: [1×751 double]
firstframe: 750
endframe: 1500
nframes: 751
off: -749
So naturally I created a python dictionary with the required fields and create a list, then used savemat. However when I loaded in matlab I only get cell arrays. I also tried using this but the problem is that not all of the fields are arrays with the same shapes for example 'firstframe' is an int. Then when I used fromarrays() but it complains because the shape does not match.
I am trying now to convert a dictionary to an structured array, but have not found anything related. And also trying to create a numpy record that allows different shapes for the arrays. Any light very welcome
In Octave
In Ipython:
Here
M
is (1,1) structured array, with all fields beingobject
dtype. That way they can each have their own shape. The scalar is a (1,1) matrix.