Can't shut down COM automation server instances of MATLAB
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm starting some automation server instances of ML:
for ix = 1:4
servH(ix) = actxserver('Matlab.Application.Single');
servH(ix).Visible = 0;
% More code...
end
I do some stuff in each session, controlling each session with some PutWorkspaceData(), GetWorkspaceData(), and Execute() methods, and when I'm done, I tried to kill these instances in a couple of different ways, e.g.:
arrayfun(@(x)x.Quit,servH);
or
for ix = 1:4
servH(ix).Quit;
end
The above seem to work when I attempt them from the command window (launching and killing from command window), but I can't seem to kill them from within my real program. The only thing that I could reliably use was (yes, it's ugly):
try
servH(ix).Execute('exit');
catch me
% Killed server, and we get Error: RPC-server is unavailable
end
Am I missing something obvious here?
64-bit R2011b on Win7 by the way...
0 个评论
回答(2 个)
Kaustubha Govind
2012-11-19
Does servH(ix).Quit pass for ix=1 and fail thereafter? If yes, I wonder if you're calling the Quit method in a loop too quickly. You could try putting in a PAUSE command and see if that helps.
2 个评论
Kaustubha Govind
2012-11-26
David: I don't have enough expertise in this area to make further suggestions. Could you please contact MathWorks Tech Support to see if they might be able to guide you better? Thanks!
mohit patil
2020-5-29
Did you get it done. if so then please tell it,without that dirty method.As i have same problem
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!