This question has been answered before, but refering to .mat
files. As @vikrantt said here -I'm copying his example code,- recent versions of Matlab save to HDF5 format and those you can just:
import numpy as np, h5py
f = h5py.File('somefile.mat','r')
data = f.get('data/variable1') # Get a certain dataset
data = np.array(data)
Note that this is covered in h5py
's own documentation about it's high level API. I'd recommend reading Group Objects to understand better how to extract information from the file, and then Numpy Compatibility