Connect shared MATLAB session to MATLAB Engine for Python
connects
to the shared MATLAB® session, eng
= matlab.engine.connect_matlab(name
=None)name
, and returns
a MatlabEngine
object as eng
.
The input argument name
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 an EngineError
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 if eng
= matlab.engine.connect_matlab(___,background
)background
is
True
. You can use this syntax with the
name
input argument in the previous syntax.
connects asynchronously if eng
= matlab.engine.connect_matlab(___,async
)async
is True
.
Not recommended. Use the background
argument instead. Do not
use for Python® Version 3.7. For more information, see Compatibility Considerations.
Do not connect the engine multiple times to the same shared MATLAB session.