Graphics Previous page   Next Page

Accessing Object Handles

MATLAB assigns a handle to every graphics object it creates. All object creation functions optionally return the handle of the created object. If you want to access the object's properties (e.g., from an M-file) you should assign its handle to a variable at creation time to avoid searching for it later.

You can always obtain the handle of an existing object with the findobj function or by listing its parent's Children property.

See Searching for Objects by Property Values -- findobj for examples.

See Protecting Figures and Axes for more information on how object handles are hidden from normal access.

Secial Object Handles

The root object's handle is always zero. The handle of a figure is either

The figure IntegerHandle property controls the type of handle the figure receives.

All other graphics object handles are floating-point numbers. You must maintain the full precision of these numbers when you reference handles. Rather than attempting to read handles off the screen and retype them, you must store the value in a variable and pass that variable whenever MATLAB requires a handle.


Previous page  Examples -- Setting Default Line Styles The Current Figure, Axes, and Object Next page

© 1994-2005 The MathWorks, Inc.