progressbar

版本 1.0.0.0 (5.4 KB) 作者: Ohad Gal
Progressbar with an abort button.
10.8K 次下载
更新时间 2003/6/18

查看许可证

This zip file contain 3 files:
progressbar.m - the progress bar
gui_active.m - polling function to be used in the runnig application (optional)
gauge_abort_icon.mat - the icon on the button (optional button)

Directions:
place 3 files in the same folder, and let MATLAB "know" it's path.
you can create as many progressbars as you want,
and update each of them using a unique handle.

if a progress bar is closed using the "X" button on the upper-right
corner of the progressbar, the function will create it again
with it's same state, see example below (use copy-paste)

% progressbar - shows a progress bar dialog based on the function "waitbar"
%
% Format: handle = progressbar( handle,increment [,string,titlestr] )
%
% Input: handle - handle to current progress bar, [] for a new one
% increment - a fraction (0..1) to increment by.
% (-1) signals the function to remove the handle from
% the persistant list and close the progressbar
% string - a string to be replaced in the progress bar (optional)
% titlestr - a title for the dialog box (optional)
%
% Output: handle - a graphic handle of the dialog box
%
%
% NOTE: this function uses a persistant list of handles and thier values.
% therefore, to delete a progressbar, please call the function with:
% progressbar( handle,-1 );
%
% an "abort" button is formed inside the progressbar, if the calling process
% uses the persistent function "gui_active". when the "abort" button is pressed,
% the Callback function "gui_active" changes it's value to zero, which enables
% the application to interactively stop execution
%
% Example: gui_active(1); % will add an abort button
% h = progressbar( [],0,'my test' );
% max_count = 1e+3;
% for idx = 1:max_count
% fprintf( '%d\n',idx )';
% h = progressbar( h,1/max_count );
% if ~gui_active
% break;
% end
% end
% progressbar( h,-1 );
%

引用格式

Ohad Gal (2024). progressbar (https://www.mathworks.com/matlabcentral/fileexchange/3607-progressbar), MATLAB Central File Exchange. 检索时间: .

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