This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Find shared MATLAB sessions to connect to MATLAB Engine for Python


names = matlab.engine.find_matlab()



names = matlab.engine.find_matlab() finds all shared MATLAB® sessions on your local machine and returns their names in a tuple. Any name in names can be the input argument to matlab.engine.connect_matlab. If there are no shared sessions running on your local machine, matlab.engine.find_matlab returns an empty tuple.


collapse all

Identify the shared MATLAB sessions running on your local machine and connect to one of them.

import matlab.engine
names = matlab.engine.find_matlab()
('MATLAB_6830', 'MATLAB_7090')

There are two shared MATLAB sessions running, so matlab.engine.find_matlab returns two names in a tuple.

Connect to the first shared MATLAB session.

eng = matlab.engine.connect_matlab('MATLAB_6830')

Introduced in R2015b