Can I open multiple instances of MATLAB using ActiveX?
7 views (last 30 days)
Show older comments
MathWorks Support Team
on 10 Sep 2012
Edited: MathWorks Support Team
on 16 Nov 2021
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
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
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.
More Answers (0)
See Also
Categories
Find more on ActiveX in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!