Can I launch more than one MATLAB session in the same C program using EngOpen in MATLAB Engine?
1 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2009-6-27
编辑: MathWorks Support Team
2022-11-18
I would like to launch more than one MATLAB session in the same C program using the MATLAB Engine routine, EngOpen.
采纳的回答
MathWorks Support Team
2017-1-7
It is not possible to launch more than one MATLAB session in the same C program with EngOpen. On Windows, the Engine Library communicates with MATLAB using ActiveX.
MATLAB is a "multiple use" automation server, which means that multiple controller clients will connect to a single instance of the MATLAB ActiveX server application. For example, suppose you have two engOpen calls in one C program. When the first engOpen call is executed and attempts to establish a connection to MATLAB, Windows will look to see if a MATLAB ActiveX automation server is already running. If one is running, a connection will be established. If one is not running, it will launch MATLAB with the /Automation command line argument. When the second EngOpen call is executed, Windows will find the current MATLAB session and connect to it.
This is important to note that the two programs will share resources in the MATLAB application, including variables in the workspace.
Workaround:
The function "engOpenSingleUse" can be used to create multiple MATLAB sessions in the same C program.
0 个评论
更多回答(1 个)
Tushar Athawale
2016-3-2
编辑:MathWorks Support Team
2022-11-18
The function "engOpenSingleUse" can be used to create multiple MATLAB sessions in the same C program:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!