A tool to convert MATLAB code to Python

A tool to convert MATLAB code to Python

There are several tools for converting Matlab to Python code.

The only one thats seen recent activity (last commit from June 2018) is Small Matlab to Python compiler (also developed here: [email protected]).

Other options include:

  • LiberMate: translate from Matlab to Python and SciPy (Requires Python 2, last update 4 years ago).
  • OMPC: Matlab to Python (a bit outdated).
  • Mat2py: Matlab to Python (Requires Python 2).

Also, for those interested in an interface between the two languages and not conversion:

  • pymatlab: communicate from Python by sending data to the MATLAB workspace, operating on them with scripts and pulling back the resulting data.
  • Python-Matlab wormholes: both directions of interaction supported.
  • Python-Matlab bridge: use Matlab from within Python, offers matlab_magic for iPython, to execute normal matlab code from within ipython.
  • PyMat: Control Matlab session from Python.
  • pymat2: continuation of the seemingly abandoned PyMat.
  • mlabwrap, mlabwrap-purepy: make Matlab look like Python library (based on PyMat).
  • oct2py (repository): run GNU Octave commands from within Python.
  • pymex: Embeds the Python Interpreter in Matlab, also on File Exchange.
  • matpy: Access MATLAB in various ways: create variables, access .mat files, direct interface to MATLAB engine (requires MATLAB be installed).
  • MatPy: Python package for numerical linear algebra and plotting with a MatLab-like interface.

Btw might be helpful to look here for other migration tips:

On a different note, for people who might find it useful there is:

Theres also oct2py which can call .m files within python


It requires GNU Octave, which is highly compatible with MATLAB.


A tool to convert MATLAB code to Python

Leave a Reply

Your email address will not be published. Required fields are marked *