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.
For a list of compatible Python versions, see MATLAB Supported Interfaces to Other Languages.
You cannot package MATLAB code that calls Python from MATLAB unless it is called in out-of-process mode.
Functions
Topics
Requirements and Highlights
- Differences Between MATLAB Engine API for Python and MATLAB Compiler SDK
Learn the differences between MATLAB Engine API for Python and MATLAB Compiler SDK for Python. - Initialize MATLAB Runtime
Initialize MATLAB Runtime for use with Python applications. - MATLAB Compiler SDK Python Target Requirements
Refer to the software requirements for using MATLAB Compiler SDK to deploy MATLAB functions to Python applications.
Create and Integrate with Python
- Generate Python Package and Build Python Application
Create a Python package in MATLAB and generate sample Python code. - Create Python Application Using Library Compiler App
Create a Python package using a graphical approach. - Install and Import MATLAB Compiler SDK Python Packages
Import compiled Python packages containing MATLAB functions into your Python application.
Sample Applications
- Create Sample Code to Call Exported Function
Generate sample code in C++, .NET, Java®, or Python by including sample files during packaging. - Create Python Package to Optimize Cost Equation
Create a Python application that solves an optimization problem. - Create Python Application with Multiple MATLAB Functions
Implement an application that computes rectangle data using multiple functions. - Calculate Win Percentage Using Python Dictionary Data
Pass statistical data between MATLAB and Python to calculate a win percentage. - Invoke a Packaged MATLAB Function
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. - matlab Python Module
Use thematlab
Python module to create MATLAB numeric types as Python variables. You can use these classes to pass MATLAB arrays between Python and MATLAB. - Use MATLAB Arrays in Python
Use MATLAB data types in a Python application.