cwaitbar.m

버전 1.0.0.0 (2.09 KB) 작성자: Rasmus Anthin
A generalization of the waitbar function. Handles nested for loops.
다운로드 수: 2.9K
업데이트 날짜: 2003/11/6

라이선스 없음

An extension/generalization of the MATLAB's WAITBAR function. Used when you want to show progress in "nested computations". Supports different coloring of bars other than the default red color. See example below on usage.

%%%%%

CWAITBAR Display compound wait bar.
H = CWAITBAR(X,TITLE) creates and displays wait bars of
fractional lengths X and with one title string TITLE.
The handle to the compound waitbar figure is returned in H.
X values should be between 0 and 1.
Each subsequent call to cwaitbar, CWAITBAR([BAR X]),
extends the length of the bar BAR to the new position X.
The first bar is the topmost bar and is BAR = 1 which
corresponds to the outermost loop.
H = CWAITBAR(X,TITLE) where TITLE is a cellstring with same
number of titles as there are fractional lengths in X.
Suitable for showing the bars' corresponding loop indices.
H = CWAITBAR(X,TITLE,COLOR) where COLOR is the color of the
bars. COLOR is either a color code character (see PLOT) or
an RGB vector. The default color is red. COLOR can also be
a cell array with same number of elements as there are bars
in the cwaitbar figure.

The order of the elements in vector X and cell arrays TITLE
and COLOR which is consistent with the bar number BAR is:
The first element corresponds to the first bar at the top
of the figure which in turn corresponds to the outermost loop.

CWAITBAR is typically used inside nested FOR loops that
performs lengthy computations.

Examples:
cwaitbar([.3 .2 .7],'Please wait...'); %single title

h = cwaitbar([0 0 0],{'i','j','k'},{[.8 .2 .8],'b','r'});
for i=1:5,
% computations %
for j=1:10
% computations %
for k=1:100
% computations %
cwaitbar([3 k/100])
end
cwaitbar([2 j/10])
end
cwaitbar([1 i/5])
end
close(h)

See also WAITBAR.

%%%%%%%%%%%

More functions available at:
http://www.etek.chalmers.se/~e8rasmus/eng/matlab_programs.html

인용 양식

Rasmus Anthin (2024). cwaitbar.m (https://www.mathworks.com/matlabcentral/fileexchange/4121-cwaitbar-m), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R10
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

Bar number BAR is now "flipped". BAR = 1, corresponds to the topmost bar and BAR = n, where n is the number of bars, corresponds to the bottom bar (innermost loop).