function progressbar(x,tit) %PROGRESSBAR Display wait bar in the statusbar. % % PROGRESSBAR('title', X) % % displays a progress bar of fractional length X in the statusbar. % X should be between 0 and 1. % Each subsequent call to progressbar, PROGRESSBAR(X), extends the % length of the bar to the new position X. % When x=1 the statusbar will be cleaned. % % for i=1:100, % % computation here % % progressbar('Working on ', i/100); % end % % Claudio Rivetti 10-21-94 % % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % if nargin==1 tit=[]; end Barlen=95-length(tit); str=zeros(1,Barlen); x=ceil(x*Barlen); str(1:x)=str(1:x)+'o'; str(x+1:Barlen)=str(x+1:Barlen)+'.'; str=[tit ' [' str ']']; if ~isempty(str) statusbar(setstr(str*find(x~=Barlen))); end return