Progress bar

버전 (9.98 KB) 작성자: Levente Hunyadi
An elegant and easy-to-use progress bar dialog utilizing the Swing GUI class JProgressBar.

다운로드 수: 3K

업데이트 날짜: 2010/3/13

라이선스 보기

The progress bar can be displayed and manipulated using two approaches.

In the procedural style, the function waitdialog wraps the Java Swing GUI class JProgressBar for enhanced visual experience but is functionally similar to the built-in function waitbar.

In the object-oriented style, ProgressDialog is a class that encapsulates a progress bar created using the waitdialog function, provides get/set access to the status message text and the progress indicator, and ensures proper cleanup on user interruption either using the cancel button or CTRL+BREAK, as well as in case an error occurs.


% show progress bar dialog
dlg = ProgressDialog();

maxiter = 50;
for iter = 1 : maxiter
% do any long-running operation

% update progress bar
dlg.FractionComplete = iter/maxiter;

% update status message
dlg.StatusMessage = sprintf('%d%% complete', fix(100*iter/maxiter));

% destroy progress bar dialog explicitly

% create progress bar dialog with custom status message
dlg = ProgressDialog( ...
'StatusMessage', 'Please wait until operation terminates...', ...
'FractionComplete', 0.25);

% hide status message
dlg.StatusMessage = [];
dlg.FractionComplete = 1;

% create progress bar with indeterminate state
% previous dialog is automatically destroyed on assignment
dlg = ProgressDialog( ...
'StatusMessage', 'Close the dialog to continue', ...
'Indeterminate', true);

인용 양식

Levente Hunyadi (2022). Progress bar (, MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2008a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!