Read .mat files in Python
scipy.io.loadmat work for MATLAB arrays version 7.3. But the good part is that MATLAB version 7.3 files are hdf5 datasets. So they can be read using a number of tools, including NumPy.
For Python, you will need the
h5py extension, which requires HDF5 on your system.
import numpy as npimport h5pyf = h5py.File('somefile.mat','r')data = f.get('data/variable1')data = np.array(data) # For converting to a NumPy array