Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

drawnow - Flush event queue and update figure window

Syntax

drawnow
drawnow expose
drawnow update

Description

drawnow causes figure windows and their children to update, and flushes the system event queue. Any callbacks generated by incoming events (e.g., mouse or key events) are dispatched before drawnow returns.

drawnow expose causes only graphics objects to refresh, if needed. It does not allow callbacks to execute and does not process other events in the queue.

drawnow update causes only non graphics objects to refresh, if needed. It does not allow callbacks to execute and does not process other events in the queue.

You can combine the expose and update options to obtain both effects:

drawnow expose update

Other Events That Cause Event Queue Processing

Other events that cause the MATLAB software to flush the event queue and draw the figure include:

Examples

Using drawnow in a loop causes the display to update while the loop executes:

t = 0:pi/20:2*pi;
y = exp(sin(t));
h = plot(t,y,'YDataSource','y');
for k = 1:.1:10
	y = exp(sin(t.*k));
	refreshdata(h,'caller') % Evaluate y in the function workspace
	drawnow; pause(.1)
end

See Also

snapnow, waitfor, waitforbuttonpress

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS