Friday, 21 November 2014

Saving Numpy arrays to Matlab compatible files

Working in Python but want to use you data in Matlab too.

A simple function call can do this. Here is the code:

import scipy.io as spio
spio.savemat('saveSymmetricPose.mat', 
             dict(matlabVarName = pythonVarName, matlabVarName1 = pythonVarName1))

Here savemat from scipy.io stores a number of arrays to a Mat file, that can be easily opened in Matlab. Hope this could help someone.

Source: converting-numpy-arrays-to-matlab-and-vice-versa

No comments:

Post a Comment