Saturday 26 January 2013

Sci: Matlab Carriage Return for Single Line Printing


1/7/2013


For smoother feedback in the user interface while loading files or loading something, you might want to overwrite your loading or status bar instead of printing it on a new line. Unfortunately, because of the linearity of stdio in most computers, there's no simple print command (that I know of...) that will do this.

In MATLAB, instead of carriage return, we actually use \b to delete previously printed characters outputted by fprintf. However, in python, you should be able to use \r to obtain the same effect.

Download the demo.

No comments:

Post a Comment