Graphics Previous page   Next Page


The EraseMode property controls how MATLAB updates the image on the screen if the image object's CData property changes. The default setting of EraseMode is 'normal'. With this setting, if you change the CData of the image object using the set command, MATLAB erases the image on the screen before redrawing the image using the new CData array. The erase step is a problem if you want to display a series of images quickly and smoothly.

You can achieve fast and visually smooth updates of displayed images as you change the image CData by setting the image object EraseMode property to 'none'. With this setting, MATLAB does not take the time to erase the displayed image -- it immediately draws the updated image when the CData changes.

Suppose, for example, that you have an m-by-n-by-3-by-x array A, containing x different truecolor images of the same size. You can display them dynamically with

Rather than creating a new image object each time through the loop, this code simply changes the CData of the image object (which was created on the first line using the image command). The drawnow command causes MATLAB to update the display with each pass though the loop. Because the image EraseMode is set to 'none', changes to the CData do not cause the image on the screen to be erased each time through the loop.

Previous page  XData and YData Additional Techniques for Fast Image Updating Next page

© 1994-2005 The MathWorks, Inc.