Is it possible to have multiple waitbars in nested FOR loops in MATLAB 6.5 (R13)?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
Respuesta aceptada
MathWorks Support Team
el 27 de Jun. de 2009
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 comentarios
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!