drawnow
drawnow
flushes the event queue and forces MATLAB to update the screen. While running an M-file, MATLAB does not render the screen with each graphics statement. For example, executing the M-file
does not draw the screen until after the final statement when MATLAB returns to its prompt. This allows for efficient execution of sequences of graphics statements. In the example above, the axis is drawn once; if typed at the command line, it would be drawn twice.plot(x,y)
axis([0 10 0 10])
title('A short title')
grid
Four events cause MATLAB to flush the event queue and draw the screen:
pause
statementgetframe
commanddrawnow
command(c) Copyright 1994 by The MathWorks, Inc.