I have a waitbar programmed into my code however every iteration through my code it opens a new GUI for it. So for example, my code has 11247 iterations which means by the time the code is done running I have 11247 waitbar figures or GUI's open. I have been trying to make it so only one GUI pops up and then only the loading bar itself updates instead of opening up a new GUI with the updated progess of the iteration bar. Does anyone know how I can fix this?
-BK

 채택된 답변

Robert Cumming
Robert Cumming 2011년 4월 17일

1 개 추천

The best way to get help is to show your code, or at lease a snipit.
In this case your probably using the waitbar wrong. From the help this is how you should use waitbar.
h = waitbar(0,'Please wait...');
for i=1:1000
% your code here %
waitbar(i/1000,h)
end

댓글 수: 2

Brian
Brian 2011년 4월 17일
while Error > .1
%lots of code
n=n+1;
progress=waitbar(0,'Running');
waitbar(n/11247,progress)
end
Where n=n+1 goes from 1 to 11247
Robert Cumming
Robert Cumming 2011년 4월 17일
did you try running my example?
your line:
progress=waitbar(0,'Running')
should be outside the loop. Look at the help to understand why.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 App Building에 대해 자세히 알아보기

질문:

2011년 4월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by