Video length is 24:30

Python for MATLAB Development

Albert Danial, Author of Python for MATLAB Development

The py module in MATLAB® provides a binary interface to Python®. It opens the door to calling more than 350,000 Python modules directly from MATLAB, a truly amazing capability. This talk covers primary steps that will help you take full advantage of Python from MATLAB:

 

  • Create Python virtual environments that pair well with your MATLAB installation
  • Test the stability of your MATLAB/Python environment
  • Extend the Python search path in MATLAB so that it can find your Python code
  • Pass MATLAB arguments to Python functions
  • Convert values returned by Python functions to native MATLAB variables
  • Write Python bridge modules to span language interface gaps

Examples begin with simple one-line commands that read and write data to and from YAML files (with PyYAML) and progress to platform-independent ways to capture memory and CPU load (with psutil) and write Excel .xlsx files with arbitrary font styles, colors, and equations (with openpyxl). Python-to-MATLAB and MATLAB-to-Python variable conversions are demonstrated with the py2mat.m and mat2py.m utilities from Python for MATLAB Development.

Published: 25 May 2022