Main Content

Get Started with MATLAB Engine API for Python

MATLAB® Engine API for Python® provides a Python package named matlab that enables you to call MATLAB functions from Python. You install the package once, and then you can call the engine in your current or future Python sessions. For help on installing or starting the engine, refer to:

The matlab package contains the following:

The engine provides functions to call MATLAB, and the array classes provide functions to create MATLAB arrays as Python objects. You can create an engine and call MATLAB functions with matlab.engine. You can create MATLAB arrays in Python by calling constructors of an array type (for example, matlab.double to create an array of doubles). MATLAB arrays can be input arguments to MATLAB functions called with the engine.

The table shows the structure of the matlab package.

Package

Function or Class

Description

matlab.engine

start_matlab()

Python function to create a MatlabEngine object, and attach it to a new MATLAB process

matlab.engine

MatlabEngine

Python class to provide methods for calling MATLAB functions

matlab.engine

FutureResult

Python class to hold results from a MATLAB function called asynchronously

matlab

double

Python class to hold array of MATLAB type double

matlab

single

Python class to hold array of MATLAB type single

matlab

int8

Python class to hold array of MATLAB type int8

matlab

int16

Python class to hold array of MATLAB type int16

matlab

int32

Python class to hold array of MATLAB type int32

matlab

int64

Python class to hold array of MATLAB type int64

matlab

uint8

Python class to hold array of MATLAB type uint8

matlab

uint16

Python class to hold array of MATLAB type uint16

matlab

uint32

Python class to hold array of MATLAB type uint32

matlab

uint64

Python class to hold array of MATLAB type uint64

matlab

logical

Python class to hold array of MATLAB type logical

matlab

object

Python class to hold a handle to a MATLAB object

Related Topics