How to wait for external executable to close?

14 visualizaciones (últimos 30 días)
Mark Golberg
Mark Golberg el 28 de Abr. de 2021
Respondida: Harsh Mahalwar el 28 de Feb. de 2024
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 !!!

Respuesta aceptada

Harsh Mahalwar
Harsh Mahalwar el 28 de Feb. de 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!

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by