Wait until another instance of MATLAB is finished executing

1 vue (au cours des 30 derniers jours)
Milad K
Milad K le 26 Mar 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?

Réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by