matlab.engine.connect_matlab
Connect shared MATLAB session to MATLAB Engine for Python
Syntax
Description
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
nameand the engine cannot find a shared MATLAB session of the same name, then you receive anEngineErrorexception.If you do not specify
nameand the engine cannot find any shared MATLAB sessions, then it starts a new shared MATLAB session.If you do not specify
nameand 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 or later. For more information, see Version History.
Examples
Input Arguments
Output Arguments
Limitations
You cannot connect the engine multiple times to the same shared MATLAB session simultaneously.