
3 Graphics
are more than one. The following four 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,
h = findobj('Type','p atch');
finds the handles of all patch objects.
Finding Objects with a Particular Property
You can specify multiple properties to narrow the search. For example,
h = findobj('Type','l ine','Color','r','Li neStyle',':');
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,
h = findobj(gca,'Type ','text','String','\ pi/2');
finds the string π/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,
set(findobj('Type','line','Color' ,'red'),'LineStyle', ':')
finds all re d l ines and sets t h e i r line style to dotted .
3-82
Kommentare zu diesen Handbüchern