Rank: 242149 based on 0 downloads (last 30 days) and 0 file submitted
photo

Vicente Reyes-Puerta

E-mail
Company/University
Uni-Mainz, Germany

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Vicente
Updated File Comments Rating
08 Mar 2013 wdisp: a pedestrian command window waitbar Creates a waitbar-like display in the command window. Author: us

Hi,
I just thought of a small tweak in the code. By using the fprintf() function instead of disp(), it is possible to avoid the flickering of the command window when it already has a scrollbar (which is actually irritating).

Here the body of the modified function:

if ~nargin & ~nargout
help wdisp;
elseif nargin == 1
fprintf(repmat(char(8),1,par));
par=0;
elseif nargin == 2
fprintf(str);
par=par+length(str);
else
par=0;
end

And here a small example to use the modified version of wdisp():

t='-\|/';
tl=wdisp( 0,num2str(0));
for i=1:40
tl=wdisp(tl);
tl=wdisp(tl,sprintf('count %3d %s',i,repmat('.',1,i)));
pause(.1);
end
disp(' ');

Hope this helps someone :)
Vicente

Contact us