How to wait for external executable to close?

7 vues (au cours des 30 derniers jours)
Mark Golberg
Mark Golberg le 28 Avr 2021
Hey,
I'm using
system
command to run an external executable (Win 10 , MALTAB 2015a). In this exe the user required to perform a simple task of choosing files and afterwards the user will close the exe APP.
Can I somehow halt/pause MATLAB, till the user closes the APP?
If I try something like this:
system(myAppPath)
disp('moose')
I can see MATLAB is busy till the APP is closed, but it prints 'moose' nevertheless.
Please Help.
THANKS !!!

Réponse acceptée

Harsh Mahalwar
Harsh Mahalwar le 28 Fév 2024
Hi Mark,
I can understand that you are trying to halt/pause MATLAB, till the MATLAB app executed by “system” function is not closed.
This can be achieved using the windows commands along with “system” function of MATLAB. Here’s an example doing the same:
sysCmd = 'start "" /wait "C:\Program Files\app1\application\app1.exe"';
system(sysCmd);
disp('moose')
Here, I have used to “/wait” to wait for the MATLAB application to close.
Use the following link to learn more about executing operating system commands and return outputs with MATLAB: https://www.mathworks.com/help/matlab/ref/system.html
I hope this helps, thanks!

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer 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