How can I connect to an instance of MATLAB that is already running?

12 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 20 Jan 2021
If an session of MATLAB has already been opened, you can use the MATLAB function "enableservice"
to MATLAB as an Automation Server. This can be recognized by the "actxGetRunningServer" command in other instances of MATLAB. To enable an instance as an Automation Server, you can execute the following command at the MATLAB Command Prompt:
state = enableservice('AutomationServer', true)
The "actxGetRunningServer" can be used as follows:
h = actxGetRunningServer('matlab.application')
This will allow you to connect to the already existing session of MATLAB.

More Answers (0)

Categories

Find more on Write COM Applications to Work with MATLAB in Help Center and File Exchange

Products


Release

R2010a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!