image thumbnail

cProgress

version 1.0.0.0 (13.6 KB) by Robert Cumming
A highly cusotomizable circular progress bar (with upto 2 bars)

434 Downloads

Updated 05 Oct 2015

View License

cProgress - a circular progress bar (with 2 circular progress notifications)

Similar to waitbar, progress indication is cicular and it can have 2 bars an inner and outer.
The progress bar can be stand alone or it can be embedded into your own GUI

Initialise
----------
h = cProgress ( initValue, userText, optArg, argValue );

initValue - the initial value (normally 0);
- or 'busy' -> this indicates a unknown process length
updateText - update the user controlled text string.
optArg - see valid options below
argValue - the value

% Valid optArgs to cusomise the GUI:
options.innerBar = false; % inc inner bar true | false
options.outerColor = [0 1 0]; % outer bar colour
options.innerColor = [0 0.8 0]; % inner bar colour
options.edgeColor = [0.7 0.7 0.7]; % edge colour
options.fade = true; % fade older bars true | false
options.forceFocus = false; % force focus of ui on each call
options.parent = []; % embed in a user GUI component
Normal mode only
options.estTime = false; % include an time estimate
Busy mode only:
options.timer = true; % use with busy mode only
options.dTime = 0.1; % time between timer calls

To extract the most upto date list of options:
options = cProgress;


Update at runtime:
------------------
cProgress ( value, h );
cProgress ( value, h, updateText );

value - value in percent that bar should be displayed
updateText - update the user controlled text string.

When using a double progress bar:

cProgress ( [outerValue innerValue], h );

outerValue - value in percent that outer bar should be displayed
innerValue - value in percent that inner bar should be displayed
- only valid if bar initialised at start by using
the "innerBar" optArg pair (see example)

Run internal demo:
------------------
cProgress ( 'demo' );
cProgress ( 'embedDemo' );
cProgress ( 'busyDemo' );
cProgress ( 'busyTimer' );

Stand alone example:
--------
Create the dialog specifying that the inner bar is included:
h = cProgress (0, 'Running Demo...', 'innerBar', true );

Update the bars [outer inner]
cProgress ( [25 40], h )

Busy Example:
-------------
h = cProgress ('busy', 'Close to quit' );
while ( true )
% Your code goes here
cProgress ( 'busy', h );
% Some condition goes here
% to break the while
%
if ~ishandle ( h ); break ;end
pause ( 0.025 );
end

Embed Example:
--------------
f = figure;
uip = uipanel ( 'parent', f, 'position', [0.2 0.2 0.4 0.4] );
h = cProgress ( 0, 'Embedded', 'parent', uip, 'outerColor', [0 0 1] )
for i=1:100
% Your code goes here...
cProgress ( i, h )
end
% Clean up the uipanel when its finished
delete ( h );

Notes:
------

1. If the dialog is closed before your calling loop is finished it
will continue to run (but not display)
2. Dont make too many calls to this function -> it can slow down
the over all progess of your code.
3. You can embed the progress bar into your own GUI by creating
a new panel for the bar to be displayed in.
4. For a busy progress bar -> the user must indicate when it is to
be updated - you can initiate this via a timer if you desire

Author : Robert Cumming
Copyright: Matpi Ltd
Developers of Matlab GUI Toolbox
- free version from www.matpi.com or
- https://github.com/robertjcumming/matpigui/releases/download/v1/DEMO-Latest.zip
- email: contact @ matpi.com

Cite As

Robert Cumming (2021). cProgress (https://www.mathworks.com/matlabcentral/fileexchange/53383-cprogress), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: progressbar, statusbar

Community Treasure Hunt

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

Start Hunting!