Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make matlab's console scroll down

I am running a script that uses fprintf to print to the console. Sometimes the console stops scrolling down to the newest line printed and I need to manually pull down the scroll bar to see the last line, which is annoying because I want to view both the console and some figures that I am plotting at each iteration.

Does anyone have a solution to this problem?

like image 274
olamundo Avatar asked Feb 14 '26 13:02

olamundo


1 Answers

The following was posted to mathworks, might shed some light:

The behavior of the Command Window in R2011a seems to have changed so that it doesn't automatically scroll to the bottom on a line feed if MATLAB is busy.

If I run this in my shiny new MATLAB 7.12.0.635:

clc, for a=1:100,fprintf('%i\n',a);pause(0.1);end

... the counter will just run down to the bottom of my CW and then keep going while the vertical scroll bar grows. My dull ol' 7.11.0.584 (R2010b) and my linux version (either release) don't do that; there the command window scrolls down on a line feed. Is that intentional new behavior or a bug? If it is a feature, how do I control it?

Edit: Okay, I'm pretty sure it's a feature. If whatever is in the loop isn't terribly computationally expensive and not calling system commands or mex code, it actually lets me choose between freezing the scrolling or letting it go by moving the scroll bar (i.e., if the scroll bar is at the bottom, it updates as it used to). Seems like this just doesn't always work.

Edit2: Also, that trick to control it only works on Windows 7.

like image 133
André C. Andersen Avatar answered Feb 17 '26 11:02

André C. Andersen