Wait until another instance of MATLAB is finished executing

조회 수: 1 (최근 30일)
Milad K
Milad K 2018년 3월 26일
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