15.3.4 Searching Properties
- : h = findobj ()
- : h = findobj (prop_name, prop_value, …)
- : h = findobj (prop_name, prop_value, "-logical_op", prop_name, prop_value)
- : h = findobj ("-property", prop_name)
- : h = findobj ("-regexp", prop_name, pattern)
- : h = findobj (hlist, …)
- : h = findobj (hlist, "flat", …)
- : h = findobj (hlist, "-depth", d, …)
-
Find graphics objects with specified properties.
When called without arguments, return all graphic objects beginning with the root object (0) and including all of its descendants.
The simplest form for narrowing the results is
findobj (prop_name, prop_value)
which returns the handles of all objects which have a property named prop_name that has the value prop_value. If multiple property/value pairs are specified then only objects meeting all of the conditions (equivalent to
-and
) are returned.The search can be limited to a particular set of objects and their descendants, by passing a handle or set of handles hlist as the first argument.
The depth of the object hierarchy to search can be limited with the
"-depth"
argument. An example of searching through only three generations of children is:findobj (hlist, "-depth", 3, prop_name, prop_value)
Specifying a depth d of 0 limits the search to the set of objects passed in hlist. A depth of 0 is also equivalent to the
"flat"
argument. The default depth value isInf
which includes all descendants.A specified logical operator may be used between prop_name, prop_value pairs. The supported logical operators are:
"-and"
,"-or"
,"-xor"
,"-not"
. Example code to locate all figure and axes objects isfindobj ("type", "figure", "-or", "type", "axes")
Objects may also be matched by comparing a regular expression to the property values, where property values that match
regexp (prop_value, pattern)
are returned.Finally, objects which have a property name can be found with the
"-property"
option. For example, code to locate objects with a"meshstyle"
property isfindobj ("-property", "meshstyle")
Implementation Note: The search only includes objects with visible handles (HandleVisibility =
"on"
). See findall, to search for all objects including hidden ones.
- : h = findall ()
- : h = findall (prop_name, prop_value, …)
- : h = findall (prop_name, prop_value, "-logical_op", prop_name, prop_value)
- : h = findall ("-property", prop_name)
- : h = findall ("-regexp", prop_name, pattern)
- : h = findall (hlist, …)
- : h = findall (hlist, "flat", …)
- : h = findall (hlist, "-depth", d, …)
-
Find graphics object, including hidden ones, with specified properties.
The return value h is a list of handles to the found graphic objects.
findall
performs the same search asfindobj
, but it includes hidden objects (HandleVisibility ="off"
). For full documentation, see findobj.
© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v6.3.0/Searching-Properties.html