Graphics    

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. However, you can always obtain the handle of an existing object with the findobj function or by listing its parent's Children property. The "Protecting Figures and Axes" section in this chapter provides for more information on how object handles are hidden from normal access.

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

The figure IntegerHandle property controls which 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, it is necessary to store the value in a variable and pass that variable whenever a handle is required.


  Examples -- Setting Default LineStyles The Current Figure, Axes, and Object