1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Searching Properties (GNU Octave (version 10.3.0))</title>
<meta name="description" content="Searching Properties (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Searching Properties (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Graphics-Data-Structures.html" rel="up" title="Graphics Data Structures">
<link href="Managing-Default-Properties.html" rel="next" title="Managing Default Properties">
<link href="Graphics-Object-Properties.html" rel="prev" title="Graphics Object Properties">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<div class="subsection-level-extent" id="Searching-Properties">
<div class="nav-panel">
<p>
Next: <a href="Managing-Default-Properties.html" accesskey="n" rel="next">Managing Default Properties</a>, Previous: <a href="Graphics-Object-Properties.html" accesskey="p" rel="prev">Graphics Object Properties</a>, Up: <a href="Graphics-Data-Structures.html" accesskey="u" rel="up">Graphics Data Structures</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Searching-Properties-1"><span>15.3.4 Searching Properties<a class="copiable-link" href="#Searching-Properties-1"> ¶</a></span></h4>
<a class="anchor" id="XREFfindobj"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-findobj"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-findobj"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findobj-1"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">(<var class="var">prop_name</var>, <var class="var">prop_value</var>, …)</code><a class="copiable-link" href="#index-findobj-1"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findobj-2"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">(<var class="var">prop_name</var>, <var class="var">prop_value</var>, "-<var class="var">logical_op</var>", <var class="var">prop_name</var>, <var class="var">prop_value</var>)</code><a class="copiable-link" href="#index-findobj-2"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findobj-3"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">("-property", <var class="var">prop_name</var>)</code><a class="copiable-link" href="#index-findobj-3"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findobj-4"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">("-regexp", <var class="var">prop_name</var>, <var class="var">pattern</var>)</code><a class="copiable-link" href="#index-findobj-4"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findobj-5"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">(<var class="var">hlist</var>, …)</code><a class="copiable-link" href="#index-findobj-5"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findobj-6"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">(<var class="var">hlist</var>, "flat", …)</code><a class="copiable-link" href="#index-findobj-6"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findobj-7"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findobj</strong> <code class="def-code-arguments">(<var class="var">hlist</var>, "-depth", <var class="var">d</var>, …)</code><a class="copiable-link" href="#index-findobj-7"> ¶</a></span></dt>
<dd><p>Find graphics objects with specified properties.
</p>
<p>When called without arguments, return all graphic objects beginning with the
root object (0) and including all of its descendants.
</p>
<p>The simplest form for narrowing the results is
</p>
<div class="example">
<pre class="example-preformatted">findobj (<var class="var">prop_name</var>, <var class="var">prop_value</var>)
</pre></div>
<p>which returns the handles of all objects which have a property named
<var class="var">prop_name</var> that has the value <var class="var">prop_value</var>. If multiple
property/value pairs are specified then only objects meeting all of the
conditions (equivalent to <code class="code">-and</code>) are returned.
</p>
<p>The search can be limited to a particular set of objects and their
descendants, by passing a handle or set of handles <var class="var">hlist</var> as the first
argument.
</p>
<p>The depth of the object hierarchy to search can be limited with the
<code class="code">"-depth"</code> argument. An example of searching through only three
generations of children is:
</p>
<div class="example">
<pre class="example-preformatted">findobj (<var class="var">hlist</var>, "-depth", 3, <var class="var">prop_name</var>, <var class="var">prop_value</var>)
</pre></div>
<p>Specifying a depth <var class="var">d</var> of 0 limits the search to the set of objects
passed in <var class="var">hlist</var>. A depth of 0 is also equivalent to the
<code class="code">"flat"</code> argument. The default depth value is <code class="code">Inf</code> which
includes all descendants.
</p>
<p>A specified logical operator may be used between <var class="var">prop_name</var>,
<var class="var">prop_value</var> pairs. The supported logical operators are:
<code class="code">"-and"</code>, <code class="code">"-or"</code>, <code class="code">"-xor"</code>, <code class="code">"-not"</code>. Example code
to locate all figure and axes objects is
</p>
<div class="example">
<pre class="example-preformatted">findobj ("type", "figure", "-or", "type", "axes")
</pre></div>
<p>Objects may also be matched by comparing a regular expression to the
property values, where property values that match
<code class="code">regexp (<var class="var">prop_value</var>, <var class="var">pattern</var>)</code> are returned.
</p>
<p>Finally, objects which have a property name can be found with the
<code class="code">"-property"</code> option. For example, code to locate objects with a
<code class="code">"meshstyle"</code> property is
</p>
<div class="example">
<pre class="example-preformatted">findobj ("-property", "meshstyle")
</pre></div>
<p>Implementation Note: The search only includes objects with visible
handles (HandleVisibility<!-- /@w --> = <code class="code">"on"</code>).
See <a class="xref" href="#XREFfindall"><code class="code">findall</code></a>, to search for all objects including
hidden ones.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfindall">findall</a>, <a class="ref" href="Handle-Functions.html#XREFallchild">allchild</a>, <a class="ref" href="Handle-Functions.html#XREFget">get</a>, <a class="ref" href="Handle-Functions.html#XREFset">set</a>.
</p></dd></dl>
<a class="anchor" id="XREFfindall"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-findall"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-findall"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findall-1"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">(<var class="var">prop_name</var>, <var class="var">prop_value</var>, …)</code><a class="copiable-link" href="#index-findall-1"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findall-2"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">(<var class="var">prop_name</var>, <var class="var">prop_value</var>, "-<var class="var">logical_op</var>", <var class="var">prop_name</var>, <var class="var">prop_value</var>)</code><a class="copiable-link" href="#index-findall-2"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findall-3"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">("-property", <var class="var">prop_name</var>)</code><a class="copiable-link" href="#index-findall-3"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findall-4"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">("-regexp", <var class="var">prop_name</var>, <var class="var">pattern</var>)</code><a class="copiable-link" href="#index-findall-4"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findall-5"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">(<var class="var">hlist</var>, …)</code><a class="copiable-link" href="#index-findall-5"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findall-6"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">(<var class="var">hlist</var>, "flat", …)</code><a class="copiable-link" href="#index-findall-6"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-findall-7"><span><code class="def-type"><var class="var">h</var> =</code> <strong class="def-name">findall</strong> <code class="def-code-arguments">(<var class="var">hlist</var>, "-depth", <var class="var">d</var>, …)</code><a class="copiable-link" href="#index-findall-7"> ¶</a></span></dt>
<dd><p>Find graphics object, including hidden ones, with specified properties.
</p>
<p>The return value <var class="var">h</var> is a list of handles to the found graphic objects.
</p>
<p><code class="code">findall</code> performs the same search as <code class="code">findobj</code>, but it
includes hidden objects (HandleVisibility = <code class="code">"off"</code>). For full
documentation, see <a class="pxref" href="#XREFfindobj"><code class="code">findobj</code></a>.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFfindobj">findobj</a>, <a class="ref" href="Handle-Functions.html#XREFallchild">allchild</a>, <a class="ref" href="Handle-Functions.html#XREFget">get</a>, <a class="ref" href="Handle-Functions.html#XREFset">set</a>.
</p></dd></dl>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Managing-Default-Properties.html">Managing Default Properties</a>, Previous: <a href="Graphics-Object-Properties.html">Graphics Object Properties</a>, Up: <a href="Graphics-Data-Structures.html">Graphics Data Structures</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|