Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

how to add a dynamically updated progress bar in a GUI window

1 Ansicht (letzte 30 Tage)
Yuzhen Lu
Yuzhen Lu am 14 Dez. 2018
Geschlossen: Yuzhen Lu am 14 Dez. 2018
I am trying to add a dynamic progress bar in a GUI. I note there are some solutions available (How to add progress bar control to Matlab gui).
My method is based on creating two panels of different colors, one for background and the other for foreground (i.e., progress bar).
My codes are as follows:
bar = uipanel('Parent',handles.bgProgressBar,'BackgroundColor','r');
%Note: bgPogressBar is the tag of a panel manually added with GUIDE
barPosition = get(bar,'Position');
cnt = 0
for ii = 1:S
for jj = 1:T
do something
.
cnt = cnt + 1;
progress = cnt/(S*T);
barPosition(3) = progress;
barPosition;
set(bar,'Position',barPosition);
end
end
The problem here is that the bar is not updated in real time. It does not repond but only progresses to the end when the loop is completed.
Is it possible to add a dynamically progressing bar in the GUI?

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by