This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Start MATLAB Engine for Python


eng = matlab.engine.start_matlab()
eng = matlab.engine.start_matlab(option)
eng = matlab.engine.start_matlab(async)
eng = matlab.engine.start_matlab(background)
eng = matlab.engine.start_matlab(___)



eng = matlab.engine.start_matlab() starts a new MATLAB® process, and returns Python® variable eng, which is a MatlabEngine object for communicating with the MATLAB process.

If MATLAB cannot be started, the engine raises an EngineError exception.


eng = matlab.engine.start_matlab(option) uses startup options specified by option.

For example, call matlab.engine.start_matlab('-desktop') to start the MATLAB desktop from Python.


eng = matlab.engine.start_matlab(async) starts MATLAB asynchronously if async is True.

eng = matlab.engine.start_matlab(background) starts MATLAB asynchronously if background is True.


eng = matlab.engine.start_matlab(___) can include any of the input arguments in previous syntaxes.


collapse all

Start an engine and a new MATLAB process from the Python command line.

import matlab.engine
eng = matlab.engine.start_matlab()

Start a different MATLAB process from each engine.

import matlab.engine
eng1 = matlab.engine.start_matlab()
eng2 = matlab.engine.start_matlab()

Start an engine with the MATLAB desktop.

import matlab.engine
eng = matlab.engine.start_matlab("-desktop")

You also can start the desktop after you start the engine.

import matlab.engine
eng = matlab.engine.start_matlab()


You can call MATLAB functions from both the desktop and Python.

Start the engine with async=True. While MATLAB starts, you can enter commands at the Python command line.

import matlab.engine
future = matlab.engine.start_matlab(async=True)
eng = future.result()

Input Arguments

collapse all

Startup options for the MATLAB process, specified as a string. You can specify multiple startup options with option.

The engine supports '-desktop' to start MATLAB with the desktop. In addition, the engine supports all MATLAB startup options, except for the options listed in Limitations.

Example: matlab.engine.start_matlab('-desktop -r "format short"') starts the desktop from Python. The engine passes '-r "format short"' to MATLAB.

Start MATLAB synchronously or asynchronously, specified as a logical keyword argument.

Example: matlab.engine.start_matlab(async=True)

Start MATLAB synchronously or asynchronously, specified as a logical keyword argument. background is an alias for async and will be removed in a future release.

Example: matlab.engine.start_matlab(background=True)

Output Arguments

collapse all

Python variable for communicating with MATLAB, returned as a MatlabEngine object if async or background is set to False or a FutureResult object if async or background is set to True.

Each time you call matlab.engine.start_matlab, it starts a new MATLAB process.


The engine does not support these MATLAB startup options:

  • -h

  • -help

  • -?

  • -n

  • -e

  • -softwareopengl

  • -logfile

Introduced in R2014b

Was this topic helpful?