Wait until another instance of MATLAB is finished executing

1 次查看(过去 30 天)
I am running a secondary MATLAB instance from within my primary MATLAB window:
% in the primary MATLAB instance
eval(['!matlab -nodesktop -r execute(' input ')&']) % this runs execute.m in the secondary MATLAB instance
where execute(input) is a function that calls for a variable named input.
While the execution time of the secondary instance (i.e. execute.m) could be quite long, I would like the primary instance to wait until this execution is finished.
Note: I know I can fetch the PID and number of different MATLAB consoles (instances) running in the system at each moment via
[status,result] = system('tasklist /FI "imagename eq matlab.exe" ')
and wait until the number of instances/PID is equivalent to what it was before opening any secondary instances, but is there any better way to address this issue?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by