I am trying to save a Python 3D int array, in which the third dimension is of variable length, in matlab format. The solution that I came up is
array = np.empty((FirstDim, SecondDim), dtype = object)
for i in range(FirstDim):
for j in range(SecondDim):
array[i][j] = ...
scipy.io.savemat('array', {'array':array})
But the problem is when I access the array variable in matlab, it is actually stored as just a 2D array.
load array.mat
array(1,1,2)
error: A(I,J,...): index to dimension 3 out of bounds; value 2 out of bound 1
Can anyone give me some suggestions so that I can access the array in matlab like it is a 3D array? Thanks!
Aucun commentaire:
Enregistrer un commentaire