Thread Subject: clear display

Subject: clear display

From: Steve

Date: 17 Jul, 2007 14:51:34

Message: 1 of 6

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!

Subject: clear display

From: David

Date: 17 Jul, 2007 15:40:24

Message: 2 of 6

clc clears the command window if that is what you want to do.

Subject: clear display

From: Steve

Date: 17 Jul, 2007 15:54:38

Message: 3 of 6

clc isn't quite it. I'd rather clear just the last line of the command window, not the entire thing. Any other ideas?

Subject: clear display

From: Loren Shure

Date: 17 Jul, 2007 14:32:06

Message: 4 of 6

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/

Subject: clear display

From: Fangjun Jiang

Date: 17 Jul, 2007 20:28:48

Message: 5 of 6

the function waitbar() may be a good choice for your need.

Subject: clear display

From: Steve

Date: 17 Jul, 2007 21:38:06

Message: 6 of 6

Both of those work well for me needs. Thanks!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com