Progress bar

版本 1.2.0.0 (10.0 KB) 作者: Levente Hunyadi
An elegant and easy-to-use progress bar dialog utilizing the Swing GUI class JProgressBar.
3.0K 次下载
更新时间 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.

EXAMPLE

% show progress bar dialog
dlg = ProgressDialog();

maxiter = 50;
for iter = 1 : maxiter
% do any long-running operation
pause(0.1);

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

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

% destroy progress bar dialog explicitly
delete(dlg);

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

% hide status message
dlg.StatusMessage = [];
dlg.FractionComplete = 1;
pause(2);

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

引用格式

Levente Hunyadi (2024). Progress bar (https://www.mathworks.com/matlabcentral/fileexchange/26773-progress-bar), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2008a
兼容任何版本
平台兼容性
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.2.0.0

Added indeterminate state; removed external dependencies.

1.1.0.0

n/a

1.0.0.0