embededprogressbar (Scripts) Publisher's description
EMBEDEDPROGRESSBAR intends to be a merge of all the previous progressbar that can be found on the FEX.
EMBEDEDPROGRESSBAR intends to be a merge of all the previous progressbar that can be found on the FEX. Its two main features are:
1) It uses classes and objects, which also each embededprogressbar to be accessed and modified through get and set functions.
2) It can be embeded in an existing figure and moved around as desired (see below).
Copy the folder @embededprogressbar in one of the folder which belongs to your Matlab path. Its subfolder should *not* be added to the path (like for every Matlab class).
epb = EMBEDEDPROGRESSBAR creates a new figure containing a new progressbar initialized with default values.
epb = EMBEDEDPROGRESSBAR(property,val,...) allows to tune the new progressbar. Supported properties are:
- VALUE (number between 0 and 1, default 0):
Sets the initial value of the progression to val.
- PARENT (figure handle, default 0, which creates a new figure):
Sets the figure in which the embededprogressbar should appear.
- TITLE (string, default empty string):
When a new figure to embed the progress bar is created, sets its name to val.
- STRING (string, default empty string, which does not display a title):
Sets the title to be displayed on top of the progresssion bar. If set to non empty string, a percentage of the progression will be displayed next to this label.
- TIMESTRING (string, default 'Estimated time remaining: '):
If sets to non-empty string, val will be displayed below the progress bar and the estimated time remaining will be computed and displayed next to this label.
- POSITION (a 4x1 array of whole number, default ):
Sets the position of the progress bar with [xpos ypox width heigth]. If val is equal to the empty matrix (the default), a position will be automatically computed depending on the size of the parent figure.
- ABORTBUTTON (logical, default false):
If set to true, an abort button will be displayed next to the progress bar, which will allow to handle abort events from the user.
- ABORTFLAG (logical, default false):
Will be set to true if the user click on the abort button.
All of these properties can be modified after the creation of the progress bar by using a set/get syntax. Examples:
% To update progression with current value:
epb = embededprogressbar
% To move an epb from one figure to another:
h1 = figure;
h2 = figure;
epb = embededprogressbar('parent',h2)
% To handle abort events from user:
epb = embededprogressbar('AbortButton',true)
% Now, press abort
flagraised = get(epb,'AbortFlag')
if flagraised, disp('User canceled operation.'); else, ...
disp('Continuing computation.'); end;
I could not find a proper way to store a reference to the object (Matlab only works on copies, not on references when calling a subfunction or a callback), which was needed to handle the abort events. I ended up using a global variable (referentetoepb) shared between embededprogressbar.m, set.m and get.m. I welcome any suggestion to get rid of global variables.
System Requirements:checkfield.m (can be found on the FEX).
Author: Jean-Yves Tinevez
Work address: Max-Plank Insitute for Cell Biology and Genetics,
Email: tinevez AT mpi-cbg DOT de
Permission is given to distribute and modify this file as long as this notice remains in it. Permission is also given to write to the author for any suggestion, comment, modification or usage.
Program Release Status: New Release
Program Install Support: Install and Uninstall