Main Content

Python Package Integration

Integrate compiled MATLAB® functions into Python® applications

MATLAB Compiler SDK™ provides Python methods to initialize the MATLAB Runtime, invoke compiled MATLAB functions, and manage data that is passed between the Python code and the MATLAB Runtime.

For information about versions of Python that are supported, see MATLAB Supported Interfaces to Other Languages.

Functions Python package for deployment outside MATLAB for building Python packages
myDeployedModule.initializeInitialize package and return a handle
myDeployedModule.initialize_runtimeInitialize MATLAB Runtime with a list of startup options
myDeployedModule.wait_for_figures_to_closeWait for all graphical figures to close before continuing
myDeployedModule.terminateClose a package
mwpythonStart a Python session using a MATLAB Compiler SDK Python package on Mac OS X

Examples and How To

Generate a Python Package and Build a Python Application

Create a Python package from MATLAB code and implement it with sample Python driver code.

Integrate a Python Package

Integrate MATLAB generated Python packages with Python applications

Import Compiled Python Packages

Import compiled Python packages containing MATLAB functions into Python

Install a MATLAB Compiler SDK Python Package

Install a Python package generated by MATLAB Compiler™

Initialize the MATLAB Runtime

Initialize the MATLAB Runtime for use with Python applications

Use MATLAB Arrays in Python

Example illustrating how to use MATLAB data types in a Python application

Invoke a Compiled MATLAB Function

Ways to invoke a compiled MATLAB function in Python

Invoke a Compiled MATLAB Function Asynchronously

Asynchronously invoke a compiled MATLAB function that uses the Python object


Pass Data to MATLAB from Python

Representation of Python data types in MATLAB

MATLAB Arrays as Python Variables

Python representation of MATLAB data types

Handle Data Returned from MATLAB to Python

Representation of MATLAB data types in Python

Integrate Python Packages on Mac OS X

How to use the mwpython script to integrate Python packages on Mac OS X

Differences Between MATLAB Engine API for Python and MATLAB Compiler SDK

List differences between MATLAB Engine API for Python and MATLAB Compiler SDK for Python