How to display a running timer in MATLAB Design App
38 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear Coder, I have design a simple app using App Design. The App supposed to show a time lapse while some other activity are running simultanously. Other thread have discussed about the implementation of time lapse under App design by the Design App such as link or link.
However, im still unable to replicate the solution given in these thread.
Hence, I tried something like below,
while app1.StarttimelapseButton.Value==1
T2 = clock;
time_elapsed = etime(T2,T1);
app1.TimeLapseEditField.Value=sprintf('%.6f',time_elapsed );
drawnow
end
% Next lines
% Function responsible for the execution of the "Other activity"
However, the code execution stuck in the while loop if using the above code.
May I know how to implement a timer in AppDesigner. The m and mlapp files that I created can be found this link.
Thanks in advance for the time to entertain this problem
4 Commenti
Mohammad Sami
il 26 Gen 2020
Modificato: Mohammad Sami
il 26 Gen 2020
No. I am suggesting that your UI update needs to be from inside the "other activity" code. If your other activity is primarily executing a for / while loop, you can also put in a line to update the UI.
If not, you can update the UI after completing certain appropriate "milestones" in your "other activity" code.
Mohammad Sami
il 26 Gen 2020
Also another option to show "activity" in appdesigner is to use uiprogressdlg. This will show a progress bar, which you can use to show the milestones / progress on.
progrssbar = uiprogressdlg(app.UIFigure);
progrssbar.Value = 0.1;
progrssbar.Message = 'Doing A';
% activity A
progrssbar.Value = 0.5;
progrssbar.Message = 'Doing B';
% activity B
progrssbar.Value = 1;
progrssbar.Message = 'Finished';
close(progrssbar);
Risposte (0)
Vedere anche
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!