File Exchange

image thumbnail

Overwritable message outputs to commandline window

version (1.98 KB) by kasim tasdemir
Alternative for 'display' function which can overwrite the previous message if required.


Updated 12 Dec 2013

View License

When you use 'display' function it does not overwrite the previous message. With this file, you can overwrite or keep previous message on commandline window. Or you can choose current message to be persistent. You can also append time stamp to the beginning of the message Very simple to use. Check >help dispstat
> dispstat('','init'); %one time only init
> dispstat('Begining the process...','keepthis','timespamp');
> for i = 1:100
> dispstat(sprintf('Processing %d%%',i),'timestamp');
> %doing some heavy stuff here
> end
> dispstat('Finished.','keepprev');


16:41:37 Begining the process...
16:41:37 Processing 100%

Comments and Ratings (13)

Duc Le

Perfect! Thanks



Greeeeeat! I was about to write something to do the same thing when I found a link to this script on the forum and it saved me 20-40m of development. Works like a peach! Big thanks to you, Mr. Tasdemir!!

Works perfectly!

Fantastic! Hopefully they'll build this functionality into the distributed version of MATLAB at some point.

Tom Clark

Lovely function, fills in some sadly lacking features of the 'disp' command and very simple to implement. Using it all over the place now!


Great Work! Thanks a lot!

Works great for me. Very easy to use. Thank you very much!

There is a typo (timespamp) in the description:
> dispstat('Begining the process...','keepthis','timespamp'); >>>>> > dispstat('Begining the process...','keepthis','timestamp');


Screenshot and description are changed

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux