Suppose you have saved a structure called “data” in matlab:

% "x" and "y" are two fields in the structure "data" data.x = linspace(1,100,100); data.y = linspace(1,100,100); % save a .mat file save('matlabfile.mat','data')

To read “x” and “y” into python:

import scipy.io # import file into a dictionary f = scipi.io.loadmat('matlabfile.mat') # read in the structure data = f['data'] # get the fields x = data[0,0]['x'] y = data[0,0]['y']

Advertisements