In matlab, I generate a random number of images, each of the shape (130,100). In this case, the number of images generated was 9. I save them into a cell array like below.
Then, I'd like to import this cell array into python numpy array of the shape (9,130,100). I've tried the following but I get this value error below.
imgs = sio.loadmat(folder+'/img_array.mat')
num_imgs=len(imgs['img_array'][0])
img_array=np.array(imgs['img_array'][0])
new_array=img_array.reshape((num_imgs,130,100))
ValueError: cannot reshape array of size 9 into shape (9,130,100)
If there's a more efficient way to save these images in matlab (for later converting to numpy arrays), I can do it that way too.