How to wait for external executable to close?

7 次查看(过去 30 天)
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 !!!

采纳的回答

Harsh Mahalwar
Harsh Mahalwar 2024-2-28
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!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by