Main Content

Python Package Integration

Integrate compiled MATLAB® functions into Python® applications

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

You cannot package MATLAB code that uses the MATLAB Python interface.


expand all Python package for deployment outside MATLAB for building Python packages
compiler.package.installerCreate an installer for files generated by MATLAB Compiler
compiler.package.InstallerOptionsOptions for creating MATLAB Compiler package installers
myDeployedModule.initializePython module to initialize package and return a handle
myDeployedModule.initialize_runtimePython module to initialize MATLAB Runtime with a list of startup options
myDeployedModule.wait_for_figures_to_closePython module to wait for all graphical figures to close before continuing
myDeployedModule.terminatePython module to close a package
mwpythonStart a Python session using a MATLAB Compiler SDK Python package on Mac OS X


Create and Integrate with Python

Generate a Python Package and Build a Python Application

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

Import Compiled Python Packages

Import compiled Python packages containing MATLAB functions into Python

Sample Applications

Invoke a Packaged 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.

Data Conversion

Pass Data Between MATLAB and Python

Learn how MATLAB converts data between Python and MATLAB data types.

Create MATLAB Arrays in Python

Create MATLAB numeric arrays in a Python session using array classes.

Use MATLAB Arrays in Python

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