Locate graphics objects
Syntax
h = findobj
h = findobj('PropertyName',PropertyValue,...)
h = findobj(objhandles,...)
h = findobj(objhandles,'flat','PropertyName',PropertyValue,...)
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 descendants.
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 descendants.
h = findobj(objhandles,'flat','PropertyName',PropertyValue,...)
restricts the search to those objects listed in objhandles and does not search descendants.
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 descendant 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:
h = findobj(gca,'Type','line')
See Also
copyobj, gcf, gca, gcbo, gco, get, set
Graphics objects include:
axes, figure, image, light, line, patch, surface, text, uicontrol, uimenu
[ Previous | Help Desk | Next ]