Main Content

matlab.engine.find_matlab

Find shared MATLAB sessions to connect to MATLAB Engine for Python

Description

example

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.

Examples

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()
names
('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')

Version History

Introduced in R2015b