How to wait for external executable to close?

7 visualizzazioni (ultimi 30 giorni)
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 !!!

Risposta accettata

Harsh Mahalwar
Harsh Mahalwar il 28 Feb 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!

Più risposte (0)

Categorie

Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by