findobj
Find graphics objects with specific properties
Syntax
Description
h = findobj returns the graphics root object and all of its
descendants.
h = findobj(
returns all objects in the hierarchy that have the specified properties set to the specified
values. You can replace prop1,value1,...,propN,valueN)prop,value pairs with other input argument
combinations from the previous syntaxes. For example, h =
findobj(prop1,value1,'-not',prop2,value2,'-property',prop3) returns all objects
that satisfy these three conditions:
The object has a property
prop1set tovalue1.The object has a property
prop2whose value is not set tovalue2.The object has a property
prop3.
h = findobj(
restricts the search to the objects listed in objhandles,___) objhandles and all of their
descendants. You can restrict the search for any of the previous syntaxes.
h = findobj(
restricts the search to the objects listed in objhandles,'-depth',d,___)objhandles and their
descendants that are up to d levels lower in the graphics object
hierarchy.
h = findobj(
restricts the search to the objects listed only in objhandles,'flat',___) objhandles. The
descendant objects are not searched. Using the 'flat' option is the same
as using the '-depth' option with d = 0.
Examples
Input Arguments
Tips
If the
HandleVisibilityproperty of an object is set to'off',findobjdoes not return that graphics object or any of its descendants. To return all objects in the hierarchy, including hidden objects, use thefindallfunction.findobjcorrectly matches any legal property value. For example, this code finds all objects having aColorproperty set tored,r, or[1 0 0]:findobj('Color','r')
When a graphics object is a descendant of more than one object identified in
objhandles, MATLAB searches the object each timefindobjencounters its handle. Therefore, implicit references to a graphics object can result in multiple returns of the object.
Version History
Introduced before R2006a









