| MATLAB Functions | Help Desk |
findobj
Locate graphics objectsh = findobj
h = findobj('PropertyName',PropertyValue,...)
h = findobj(objhandles,...)
h = findobj(objhandles,'flat','PropertyName',PropertyValue,...)
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.
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.
Find all Line objects in the current Axes:
h = findobj(gca,'Type','line')
copyobj, gcf, gca, gco, get, set
axes, figure, image, light, line, patch, surface, text, uicontrol, uimenu