Is it possible to have multiple waitbars in nested FOR loops in MATLAB 6.5 (R13)?

3 次查看(过去 30 天)
Using the WAITBAR function, I would like to have multiple waitbars in nested FOR loops. I would like to know if there is an example of how to do this.

采纳的回答

MathWorks Support Team
The code below is an example of creating multiple waitbars in nested FOR loops.
% Create bar for outer loop
h1 = waitbar(0,'I waitbar Please wait...');
for i=1:100
% Create bar for inner loop
h2=waitbar(0,'J waitbar Please wait...');
% Change position of second bar so the is not overlap
pos_w1=get(h1,'position');
pos_w2=[pos_w1(1) pos_w1(2)+pos_w1(4) pos_w1(3) pos_w1(4)];
set(h2,'position',pos_w2,'doublebuffer','on')
% Scroll through first waitbar
for j=1:100
waitbar(j/100,h2)
end
% Scroll through second waitbar
waitbar(i/100,h1)
% Close first waitbar, recreate in each iteration of outer loop
close(h2)
end
% Close final waitbar
close(h1)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 App Building 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by