Be the first to rate this file! 15 downloads (last 30 days) File Size: 10.05 KB File ID: #17802

embededprogressbar

by Jean-Yves Tinevez

 

29 Nov 2007 (Updated 02 Jan 2008)

Code covered by BSD License  

EMBEDEDPROGRESSBAR An object-based progressbar, designed for tunability.

Download Now | Watch this File

File Information
Description

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).
  
  INSTALL:

  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).

  SYNTAX:

  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
   set(epb,'value',0.5)

  % To move an epb from one figure to another:
   h1 = figure;
   h2 = figure;
   epb = embededprogressbar('parent',h2)
   set(epb,'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;

  WARNING:

  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.

  REQUIREMENTS:
  
  checkfield.m (can be found on the FEX).

  Author: Jean-Yves Tinevez
  Work address: Max-Plank Insitute for Cell Biology and Genetics,
  Dresden, Germany.
  Email: tinevez AT mpi-cbg DOT de
  November 2007;
  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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
WORKBAR

MATLAB release MATLAB 7.5 (R2007b)
Other requirements checkfield.m (here on the FEX)
Zip File Content  
Other Files
@embededprogressbar/char.m,
@embededprogressbar/delete.m,
@embededprogressbar/display.m,
@embededprogressbar/embededprogressbar.m,
@embededprogressbar/get.m,
@embededprogressbar/reset.m,
@embededprogressbar/set.m,
@embededprogressbar/update.m,
__MACOSX/@embededprogressbar/._display.m,
__MACOSX/@embededprogressbar/._embededprogressbar.m,
__MACOSX/@embededprogressbar/._get.m,
__MACOSX/@embededprogressbar/._reset.m,
__MACOSX/@embededprogressbar/._set.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
02 Jan 2008

Cleaned up the class directory.

Tag Activity for this File
Tag Applied By Date/Time
gui tools Jean-Yves Tinevez 22 Oct 2008 09:37:15
example Jean-Yves Tinevez 22 Oct 2008 09:37:15
progress bar Jean-Yves Tinevez 22 Oct 2008 09:37:15
class Jean-Yves Tinevez 22 Oct 2008 09:37:15
embedded Jean-Yves Tinevez 22 Oct 2008 09:37:15
merge Jean-Yves Tinevez 22 Oct 2008 09:37:15
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com