Implements progress window for IMAT.
imat_progress(0,'Progress title')
imat_progress(0,'Progress title','modal')
imat_progress(1,0.5)
imat_progress(2,'Item progress')
imat_progress(-1)
IMAT_PROGRESS is a utility function that displays and updates a progress bar. Only one progress bar may be used at a time.
The first argument to IMAT_PROGRESS is a flag specifying what action to take. The table below describes the additional arguments possible for each action.
First Argument | Additional Argument(s) |
'register' |
H_PATCH,H_TEXT[,H_APPSTOP,S_APPSTOP] This allows you to pre-register handles to a patch (H_PATCH) and text object (H_TEXT). If these are registered, when you use the 0 action, IMAT_PROGRESS will use the supplied handles. H_APPSTOP is an optional handle for where to store the appdata for when the user stops. If H_APPSTOP and S_APPSTOP are not provided (or 'register' is not used), H_APPSTOP defaults to H_PATCH and S_APPSTOP defaults to 'IMATProgressStop'. |
0 |
TITLE[,'modal'][,'stopbutton'] This initializes the figure window with given title. If a patch and handle object was not pre-registered, IMAT_PROGRESS will create a new figure. Supplying 'modal' will make the proogress figure modal. 'stopbutton' creates a Stop button on the progress bar. If the user clicks on this button, the appdata S_APPSTOP on the handle H_APPSTOP will be set (see 'register' option for more details). If this appdata is set to true when IMAT_PROGRESS is called with the 1 or 2 action, it will throw an error. |
1 | Sets the progress percentage to the numeric fraction specified by X. X must be between 0 and 1. |
2 | STR is a string specifying the string to place just above the progress bar. |
3 | RGBVEC is a 1x3 vector that sets the progress bar color (pass in [] to reset the color to the default). |
-1 | -none- |
Any other value returns a null string.
>> imat_progress(0,'File read','modal');
>> imat_progress(2,'Reading file...');
>> imat_progress(1,0.25);
>> imat_progress(1,0.5);
>> imat_progress(1,0.75);
>> imat_progress(1,1);
>> imat_progress(-1);