81 this.title= sprintf(title,varargin[:]);
83 this.title= sprintf(
" %s (%d total) ",title,total);
108 if isempty(total) || ~isscalar(total) || total <= 0
109 error(
" Total must be a positve scalar value ");
115 this.wb= waitbar(0,this.title,
" Visible ",
" off ");
117 mpos =
get(0,
" MonitorPositions ");
119 npos =
get(this.wb,
" Position ");
120 npos(1) = (mpos(1,3)/2-npos(3));
121 set(this.wb,
" Position ",npos);
123 set(this.wb,
" Visible ",
" on ");
125 fprintf(
" %s: ",this.title);
138 error(
" Set requires a value to set. ");
140 if value > this.total
162 if value + this.cur > this.total
163 value = this.total - this.cur;
164 elseif value < -this.cur
167 this.cur= this.cur + value;
184 if ~isempty(this.wb) && ishandle(this.wb)
188 fprintf(
" done!\n ");
198 #if 0 //mtoc++: 'set.UseWaitbar'
200 if ~islogical(value) || ~isscalar(value)
212 perc = this.cur/this.total;
213 pstr = sprintf(
" %2.0f%% ",round(perc*100));
215 waitbar(perc,this.wb,sprintf(
" %s: %s ",this.title,pstr));
218 fprintf(
" %s ",pstr);
219 this.p= ceil(perc*10)/10;
function start(double total)
Starts the process indicator with the given total process amount.
function set(value)
Directly sets the current process value.
ProcessIndicator(char title,double total,logical wb, varargin)
Creates a new ProcessIndicator.
Matlab's base handle class (documentation generation substitute)
A variable number of input arguments.
function step(double value)
Reports process to the indicator and triggers waitbar or text output.
function stop()
Stops the process indication and closes the waitbar, if any.
ProcessIndicator: A simple class that indicates process either via waitbar or text output...
logical UseWaitbar
Flag that indicates if a waitbar should be used.