Can I open multiple instances of MATLAB using ActiveX?

7 views (last 30 days)
I am trying to set up MATLAB as an ActiveX automation server. However, I noticed MATLAB is using the same environment when two clients are connected. This caused the variables to be corrupted. I would like to be able to generate additional copies of MATLAB having separate environments with new clients.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 30 Dec 2021
Edited: MathWorks Support Team on 16 Nov 2021
In MATLAB 5.2 and earlier versions it was not possible to instantiate multiple copies of MATLAB via ActiveX.
As of MATLAB 5.3, it is possible to do this. Instead of using a ProgID of "Matlab.Application" when instantiating MATLAB, use "Matlab.Application.Single". For example use the following:
set Matlab1 = CreateObject("Matlab.Application.Single")
set Matlab2 = CreateObject("Matlab.Application.Single")
This will create two separate instances of MATLAB in Visual Basic. See Chapter 7 of the External Interfaces/API Guide for more details on using MATLAB as an ActiveX automation server:
  2 Comments
Sam Cook
Sam Cook on 25 Feb 2020
Do you mean to say that Script1 stops mid-execution on Matlab1, then continues execution on Matlab2? What MATLAB code is being run from the scripts?
I expect there is something else going on here, since (to my knowledge) it would be nontrivial to pause execution and resume it on another MATLAB instance.

Sign in to comment.

More Answers (0)

Products


Release

R14SP2

Community Treasure Hunt

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

Start Hunting!