Wait until another instance of MATLAB is finished executing

1 visualización (últimos 30 días)
Milad K
Milad K el 26 de Mzo. de 2018
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?

Respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by