Path: news.mathworks.com!not-for-mail
From: Loren Shure <loren@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: clear display
Date: Tue, 17 Jul 2007 14:32:06 -0400
Organization: The MathWorks
Lines: 28
Message-ID: <MPG.2106d533a7ef8809989774@news.mathworks.com>
References: <f7il1m$t37$1@fred.mathworks.com>
NNTP-Posting-Host: shurel.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1184697126 15188 144.212.219.159 (17 Jul 2007 18:32:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 17 Jul 2007 18:32:06 +0000 (UTC)
User-Agent: MicroPlanet-Gravity/2.70.2067
Xref: news.mathworks.com comp.soft-sys.matlab:419558



In article <f7il1m$t37$1@fred.mathworks.com>, 
steveDEL.bachmeierDEL@yahoo.com says...
> I have a loop that takes about 10 minutes to run.  As this takes longer than expected, I would like a simple note displayed on the workspace showing the percentage.  I am successful doing:
> 
> for time=t';    %running time [hr]
>     
>     percent=round(time/size(t,1)*100);
>     display(['Running... ',num2str(percent),'%'])
> 
> The problem is only that each loop displays the note, creating a long list on the workspace.  How can I clear the displayed line at the end of the loop and replace it with the newer one to show a single line with a changing percent done?
> 
> Thanks!
> 

This code illustrates what I think you are after... but I am not sure it 
will be quite what you want. If you don't have the pause in, you won't 
see anything but the last statement because MATLAB tries to be efficient 
about not writing to the command window "too often."

fprintf(1,'here''s my integer:  ');
for i=1:9
    fprintf(1,'\b%d',i); pause(.1)
end
fprintf('\n')


-- Loren
http://blogs.mathworks.com/loren/