Can I open multiple instances of MATLAB using ActiveX?
3 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:
1 Comment
ES
on 5 Feb 2020
Does this really work?
I use MATLAB R2016B. And this is what I see.
Step 1: I dispatch a matlab instance with '.Single' option and run a script1. It starts and executes.
Step 2: I dispatch an other matlab instance with '.Single' option and run a script 2. It starts and executes. The first instance and script1 execution is blocked.
After script 2 executes, script1 executes in 2nd 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!