MATLAB Functions Help Desk

findobj

Purpose

Locate graphics objects

Syntax

Description

findobj locates graphics objects and returns their handles. You can limit the search to objects with particular property values and along specific branches of the hierarchy.

h = findobj returns the handles of the Root object and all its descendents.

h = findobj('PropertyName',PropertyValue,...) returns the handles of all graphics objects having the property PropertyName, set to the value PropertyValue. You can specify more than one property/value pair, in which case, findobj returns only those objects having all specified values.

h = findobj(objhandles,...) restricts the search to objects listed in objhandles and their descendents.

h = findobj(objhandles,'flat','PropertyName',PropertyValue,...) restricts the search to those objects listed in objhandles and does not search descendents.

Remarks

findobj returns an error if a handle refers to a non-existent graphics object.

When you specify a property value, use the same format as get returns. For example, you must use the RGB format to specify a color value and when the value is a string, you must specify the entire character string.

When a graphics object is a descendent of more than one object identified in objhandles, MATLAB searches the object each time findobj encounters its handle. Therefore, implicit references to a graphics object can result in its handle being returned multiple times.

Examples

Find all Line objects in the current Axes:

See Also

copyobj, gcf, gca, gco, get, set

axes, figure, image, light, line, patch, surface, text, uicontrol, uimenu



[ Previous | Help Desk | Next ]