Update figure window and execute pending callbacks
drawnow update updates all graphics and UI objects only if the graphics renderer is free. Otherwise, it discards the updates. This option defers callbacks until the next system queue flush.
These are other actions that flush the system queue:
Returning to the MATLAB® prompt
Executing one of these functions:
Executing waitforbuttonpress, waitfor, ginput or other functions that wait for user input
Any code that causes one of the above functions to execute. For example, suppose ax is an axes object. Calling axes(ax) causes the parent figure to be made the current figure and brought to the front of all displayed figures, which is equivalent to executing a drawnow command.
Use drawnow to display the updates after each iteration through the loop.
t = 0:pi/100:2*pi; y = exp(sin(t)); h = plot(t,y,'YDataSource','y'); for k = 1:0.01:10 y = exp(sin(t.*k)); refreshdata(h,'caller') drawnow end