Background
If you have a Matlab variable, say a matrix, that you want to read in Python. How will you do that? In this post, I am introducing a way that works 100%.
1. Save Matlab variable(s) to ‘.mat’ file.
save('your_file_name.mat', 'first_var', 'second_var',...)
2. In Python, load ‘.mat’ file using `scipy.io`.
import scipy.io scipy.io.loadmat('your_file_name.mat')
References:
http://www.mathworks.com/help/matlab/ref/save.html?refresh=true
http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.io.loadmat.html