You seem to be working on the assumption that scipy.io.savemat
designed to preserve a standard dictionary. I do not believe that this is so. The dictionary argument contains the names of the numpy arrays that are written to the Matlab file. So you can do something like this
import scipy.io as io import numpy as np y1=np.array([1,2,3,4]) y2=np.array([10,20,30,40]) y3=np.array([100,200,300,400]) a={} a['test1']=y1 a['test2']=y2 a['test3']=y3 io.savemat('temp',a) b = io.loadmat('temp') print b['test1'] print b['test2'] print b['test3']
which gives:
[[1] [2] [3] [4]] [[10] [20] [30] [40]] [[100] [200] [300] [400]]
source share