| MATLAB Functions | Help Desk |
drawnow
Complete pending drawing eventsdrawnow
drawnow
flushes the event queue and updates the Figure window.
Other events that cause MATLAB to flush the event queue and draw the Figure windows include returning to the MATLAB prompt, a pause statement, a waitforbuttonpress statement, a waitfor statement, a getframe statement, and a figure statement.
Executing the statements
x = -pi:pi/20:pi;
plot(x,cos(x))
drawnow
title('A Short Title')
grid
as an M-file updates the current Figure after executing the drawnow function and after executing the final statement.
waitfor, pause, waitforbuttonpress