How to wait for external executable to close?

16 views (last 30 days)
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 !!!

Accepted Answer

Harsh Mahalwar
Harsh Mahalwar on 28 Feb 2024 at 9:39
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!

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!