matlab.engine.connect_matlab
Connect sharedMATLABsession toMATLABEngine forPython
Syntax
Description
connects to the shared MATLAB®session,eng
= matlab.engine.connect_matlab(name
=None)name
, and returns aMatlabEngine
object aseng
. The input argumentname
specifies the name of a MATLAB session that is already running on your local machine.
If you specify
name
and the engine cannot find a shared MATLAB session of the same name, then you receive anEngineError
exception.If you do not specify
name
and the engine cannot find any shared MATLAB sessions, then it starts a new shared MATLAB session.If you do not specify
name
and the engine finds multiple shared MATLAB sessions running, then it connects to the first created session.
connects asynchronously ifeng
= matlab.engine.connect_matlab(___,background
)background
isTrue
. You can use this syntax with thename
input argument in the previous syntax.
connects asynchronously ifeng
= matlab.engine.connect_matlab(___,async
)async
isTrue
. Not recommended. Use thebackground
argument instead. Do not use for Python®Version 3.7 or later. For more information, seeCompatibility Considerations.
Examples
Input Arguments
Output Arguments
Limitations
Do not connect the engine multiple times to the same shared MATLAB session.