File Exchange

image thumbnail

wdisp: a pedestrian command window waitbar

version 1.0 (1.39 KB) by

Creates a waitbar-like display in the command window.

0 Downloads

Updated

View License

Creates the equivalent of WAITBAR in the command window.
See:
help wdisp
for a self-explanatory example - or type:

t='-\|/';
for i=1:40
tl=wdisp( 0,sprintf('time %c %s',t(rem(i,4)+1),datestr(now)));
% do some computation(s)
tl=wdisp(tl,sprintf('count %3d %s',i,repmat('.',1,i)));
% do more computation(s)
pause(.1);
tl=wdisp(tl);
end

Comments and Ratings (10)

N/A

N/A (view profile)

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

Burra Burra

Shame on me!

Burra Burra

Sorry for the previous, wrong rating

Burra Burra

1000 downloads to recover 5th place

I will resist

150 dl saterday night mode?

The Boss

Swathi krishna Burra

After click of matlab 7.0.(R14) icon command window displays after appearance of command prompt window closes automatically.I tried after reinstall of my operating system and matlab problem repeats the same?I cannot do my work due to this trouble ?please solve my problem

Chi Chi

UAU, > 500 downloads in less than a second. ?????????????????

zeus matlab heavens

Mrs. Klaublauer, this program is working perfectly for the rest of the world! What you are experiencing is a problem of your operating system. Please refrain from rating submissions just because you are frustrated - and please, add a valid email address to your review so the author can get in touch with you.

Lava Klaublauer

Matlab R12 displays boxes for char(8) instead of doing a backspace, breaking this. I don't know of any solution.

Updates

slightly changed example in <description>

corrected incomplete update

add <help> entry:
input must be a STRING

MATLAB Release
MATLAB 5.2 (R10)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video