Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
'rewind' the command window?

Subject: 'rewind' the command window?

From: Thomas Clark

Date: 6 Nov, 2009 17:14:04

Message: 1 of 3

I currently have a piece of code which runs for a long time.

Rather than leaving the command window blank, I like to update the user with a progress message after every iteration.

However, using the disp() command, over ~20000 iterations, any warning messages that come up are swamped by the progress indicator lines.

Is there any way that I can 'rewind' the command window, and reprint the previous line with an updated progress status?

Thanks for any help!

Tom Clark

Subject: 'rewind' the command window?

From: someone

Date: 6 Nov, 2009 17:30:18

Message: 2 of 3

"Thomas Clark" <t.clark@remove.spamcantab.net> wrote in message <hd1lgr$rgd$1@fred.mathworks.com>...
> I currently have a piece of code which runs for a long time.
>
> Rather than leaving the command window blank, I like to update the user with a progress message after every iteration.
>
> However, using the disp() command, over ~20000 iterations, any warning messages that come up are swamped by the progress indicator lines.
>
> Is there any way that I can 'rewind' the command window, and reprint the previous line with an updated progress status?
>
> Thanks for any help!
>
> Tom Clark

% Perhaps usiung the diary command might help?

doc diary

Subject: 'rewind' the command window?

From: kasim tasdemir

Date: 12 Dec, 2013 09:53:14

Message: 3 of 3

Hi,

I use 'dispstat' function just for this purpose. It can update the previous output which is a missing function of default 'disp'. Very simple to use. It can be downloaded from here: http://www.mathworks.com/matlabcentral/fileexchange/44673-overwritable-message-outputs-to-commandline-window

***Sample usage:
 dispstat('','init'); % One time only initialization
 dispstat(sprintf('Begining the process...'),'keepthis','timestamp');
 for i = 97:100
     dispstat(sprintf('Progress %d%%',i),'timestamp');
     %doing some heavy stuff here
 end
 dispstat('Finished.','keepprev');

***Output:
11:25:37 Begining the process...
11:25:37 Progress 100%
Finished.

All the best,
Kasim Tasdemir

"Thomas Clark" wrote in message <hd1lgr$rgd$1@fred.mathworks.com>...
> I currently have a piece of code which runs for a long time.
>
> Rather than leaving the command window blank, I like to update the user with a progress message after every iteration.
>
> However, using the disp() command, over ~20000 iterations, any warning messages that come up are swamped by the progress indicator lines.
>
> Is there any way that I can 'rewind' the command window, and reprint the previous line with an updated progress status?
>
> Thanks for any help!
>
> Tom Clark

Tags for this Thread

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.

Contact us