% save .mat file in the matlab train_set_x=1:50*1*51*61*23; train_set_x=reshape(train_set_x,[50,1,51,61,23]); save(['pythonTest.mat'],'train_set_x','-v7.3');
The data obtained in the matrix have a size (50,1,51,61,23).
I am loading a .mat file in Python with this instruction.
The code is as follows:
import numpy as np, h5py f = h5py.File('pythonTest.mat', 'r') train_set_x = f.get('train_set_x') train_set_x = np.array(train_set_x)
The output train_set_x.shape file is (23L, 61L, 51L, 1L, 50L) . It is expected to be (50L, 1L, 51L, 61L, 23L) . So I changed the form to
train_set_x=np.transpose(train_set_x, (4,3,2,1,0))
I'm interested in learning about data form changes between Python and Matlab. Are there any errors in my code?