Main Content

matlab.engine.shareEngine

Convert running MATLAB session to shared session

Description

example

matlab.engine.shareEngine converts the current MATLAB® session to a shared session with a default name. The default name is 'MATLAB_<process_ID>', where <process_ID> is a number that indicates the process ID of the current MATLAB session.

example

matlab.engine.shareEngine(name) converts the current MATLAB session to a shared session and gives it the specified name.

If there is already a shared MATLAB session on your local machine that has the specified name, then matlab.engine.shareEngine converts the current session to a shared session with a default name.

Examples

collapse all

Convert the current MATLAB session to a shared session with a default name.

matlab.engine.shareEngine
matlab.engine.engineName
ans =

MATLAB_49593

matlab.engine.shareEngine gives the shared session the default name MATLAB_49593, where 49593 is the process ID of the MATLAB session. The process ID is different each time you start MATLAB.

Give a name to the current MATLAB session and share the session.

matlab.engine.shareEngine('Engine_1')
matlab.engine.engineName
ans =

Engine_1

Input Arguments

collapse all

Name for the shared MATLAB session, specified as a character array or string. name must be a valid MATLAB variable name. For information on valid names, see Variable Names.

Data Types: char | string

Limitations

  • matlab.engine.shareEngine is not supported for deployed applications.

Tips

You also can use a MATLAB startup option to start a shared session. To start a shared MATLAB session, type this command at the operating system prompt:

matlab -r "matlab.engine.shareEngine"

Version History

Introduced in R2015b