Getting Started Previous page   Next Page

Finding the Handles of Existing Objects

The findobj function enables you to obtain the handles of graphics objects by searching for objects with particular property values. With findobj you can specify the values of any combination of properties, which makes it easy to pick one object out of many. findobj also recognizes regular expressions (regexp).

For example, you might want to find the blue line with square marker having blue face color.You can also specify which figures or axes to search, if there are more than one. The following sections provide examples illustrating how to use findobj.

Finding All Objects of a Certain Type

Because all objects have a Type property that identifies the type of object, you can find the handles of all occurrences of a particular type of object. For example,

finds the handles of all patch objects.

Finding Objects with a Particular Property

You can specify multiple properties to narrow the search. For example,

finds the handles of all red dotted lines.

Limiting the Scope of the Search

You can specify the starting point in the object hierarchy by passing the handle of the starting figure or axes as the first argument. For example,

finds the string pi/2 only within the current axes.

Using findobj as an Argument

Because findobj returns the handles it finds, you can use it in place of the handle argument. For example,

finds all red lines and sets their line style to dotted.


Previous page  Specifying the Axes or Figure Animations Next page

© 1994-2005 The MathWorks, Inc.