progressbar

Version 1.0.0.0 (5.45 KB) by Ohad Gal
Progressbar with an abort button.
10.8K Downloads
Updated Wed, 18 Jun 2003 10:43:20 +0000

View License

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 );
%

Cite As

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

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Dialog Boxes in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0