It happens. You have old data in matlab .mat format or your colleagues insist, for some obscure reason, on using MATLAB. You need scipy.io.loadmat and scipy.io.savemat from scipy.
X now contains a dictionary whose keys correspond to the variable names saved in the original mat file.
UPDATE:
Nested dictionaries seem to be a problem. A kind soul has a short set of methods that converts nested dictionaries here.
UPDATE:
Look here (scipy cookbook) for how to handle mat files from recent versions of matlab
import scipy.io
X = scipy.io.loadmat('mydata.mat')
X now contains a dictionary whose keys correspond to the variable names saved in the original mat file.
UPDATE:
Nested dictionaries seem to be a problem. A kind soul has a short set of methods that converts nested dictionaries here.
UPDATE:
Look here (scipy cookbook) for how to handle mat files from recent versions of matlab
Hi,
ReplyDeleteLoved this trick:)
thanks! it's very useful
ReplyDeleteVery useful, thanks
ReplyDeleteDoesn't read Matlab 7.3 files. It complains and suggests using the HDF reader.
ReplyDeleteHi,
ReplyDeleteThanks for pointing that out! From the cookbook (http://www.scipy.org/Cookbook/Reading_mat_files) I see that they suggest using PyTables or h5py packages.
Thank you so much! I love to find out something like that is actually extremely easy. :)
ReplyDelete