Progress

버전 1.3 (6.75 KB) 작성자: Allen
Replacement for the waitbar function.
다운로드 수: 125
업데이트 날짜: 2018/8/17

라이선스 보기

This function is an adaptation of Steve Hoelzer's progressbar.m function. It provides similar features, but with improvements to behavior when utilizing multiple task bars as well as several bug fixes. Many thanks go out to Steve for his initial ground work and for inspiring this function.

Features:
- Provides a graphical representation to indicate task completion for
loops and nested-loops. (Time remaining and percentage complete).
- Supports multiple taskbars in a single figure (nested-loops).
- Provides enhanced execution times when compared to similar functions.
- Progress() function can be used with minimal lines of code.
- Simple to update, add, remove, and/or rename/reset taskbars to the
main figure.
- Optional taskbars labels.
- Figure closes automatically when primary task is 100%.
- Only one progress bar figure can exist to prevent desktop clutter.
- Displays progress bar figure on top of other windows.
(Designed for Windows 8 and may not work with other systems.)
- Progress bar figure can be deleted during a loop without errors.
- Works in loops that target other axes objects.
- Display options for taskbar color and font.
- Randomizes taskbar color when mouse-clicked. For Fun!

m = 1e3;
n = m/2;
o = 1e4;
t = 0.0005;

Opts = {'color','cyan',...
'fontname','cambria',...
'fontweight','bold',...
'fontcolor',[1,0,0]}; % Display options [cell]
Progress('Plotting',Opts) % Initializes figure with 1 taskbar and display options
x = 0:0.005:2*pi;
np = length(x);
for i=1:np
plot(x,sin(x+6*x(i)),x,cos(x+13*x(i)));grid on
Progress(i/np) % Updates the taskbar progress
pause(t)
end
close

Opts = {'color',[0.3,0.3,0.3],...
'fontweight','bold',...
'fontcolor','green'}; % Display options [cell]
Progress('Task 1','Task 2',Opts) % Initializes figure with 2 taskbars and display options
for i=1:m
Progress(i/(m+n),i/m) % Updates both taskbars
pause(t)
end

Progress([],'Task 3') % Renames/resets the 2nd taskbar
for i=1:n
Progress((m+i)/(m+n),i/n) % Updates taskbars 1 & 2 (removes all others if present)
pause(t)
if i==n/2
Progress([],[],'Task 4') % Adds a 3rd taskbar
for j=1:o
Progress((m+i+j/o)/(m+n),(i+j/o)/n,j/o) % Updates all 3 taskbars
pause(t)
end
end
end

인용 양식

Allen (2024). Progress (https://www.mathworks.com/matlabcentral/fileexchange/67913-progress), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2018a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Loops and Conditional Statements에 대해 자세히 알아보기
도움

받음: progressbar

Community Treasure Hunt

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

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

Added functionality to change the taskbar appearance. Also makes it easier to add, remove, and/or rename/reset taskbars to an existing figure. Various minor bug fixes.

1.0.0.0

Added thumbnail image to file exchange.
Added a feature item to the description.