Pause and restart when my app finished

11 views (last 30 days)
Alessandro Alberico
Alessandro Alberico on 28 Mar 2019
Answered: Marc Youcef on 4 Nov 2020
How can I pause the matlab script until I've closed a matlab app?
In my case, I've an app that serves to select the input of my calculations, but while I'm choosing the input the script continues to run. I need to suspend the script until the user has finished to select the input.
What can I do?
  3 Comments
Alessandro Alberico
Alessandro Alberico on 29 Mar 2019
Now I tried to use a 'flag' in this way, and it's quite satisfying:
flag=0;
d=fopen('nomi piattaforme.txt');
c=textscan(d,'%s','Delimiter',',');
run scelta.mlapp
while flag==0
pause(5);
end
a=1
And at the end of the app I assigned to 'flag' the value 1 with "assignin".
Maybe it is not the smartest way, but it works enough...

Sign in to comment.

Answers (1)

Marc Youcef
Marc Youcef on 4 Nov 2020
There is indeed cleaner way, as explained here:
my_app_handle = my_app;
uiwait(my_app_handle.UIFigure_property)
disp("hello")
hello

Community Treasure Hunt

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

Start Hunting!