Mercurial > hg > octave-nkf
annotate scripts/plot/findobj.m @ 17126:26589abbc78d
Don't pass axis handle unnecessarily from high level to low level plot functions.
* scripts/plot/comet.m, scripts/plot/comet3.m, scripts/plot/compass.m,
scripts/plot/contour.m, scripts/plot/contourf.m, scripts/plot/cylinder.m,
scripts/plot/ellipsoid.m, scripts/plot/errorbar.m, scripts/plot/feather.m,
scripts/plot/mesh.m, scripts/plot/meshc.m, scripts/plot/meshz.m,
scripts/plot/pcolor.m, scripts/plot/plot3.m, scripts/plot/rectangle.m,
scripts/plot/rose.m, scripts/plot/scatter3.m, scripts/plot/semilogxerr.m,
scripts/plot/semilogy.m, scripts/plot/semilogyerr.m, scripts/plot/slice.m,
scripts/plot/sphere.m, scripts/plot/stairs.m, scripts/plot/surf.m,
scripts/plot/surfc.m, scripts/plot/surfnorm.m, scripts/plot/trimesh.m,
scripts/plot/trisurf.m: Don't pass hax to lower level functions after
newplot() has been called.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 31 Jul 2013 18:42:17 -0700 |
parents | eaab03308c0b |
children | 3fd617363762 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14001
diff
changeset
|
1 ## Copyright (C) 2007-2012 Ben Abbott |
6935 | 2 ## |
7016 | 3 ## This file is part of Octave. |
6935 | 4 ## |
7016 | 5 ## Octave is free software; you can redistribute it and/or modify it |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
6935 | 14 ## |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6935 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
20 ## @deftypefn {Function File} {@var{h} =} findobj () |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
21 ## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, @dots{}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{h} =} findobj (@var{prop_name}, @var{prop_value}, "-@var{logical_op}", @var{prop_name}, @var{prop_value}) |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
23 ## @deftypefnx {Function File} {@var{h} =} findobj ("-property", @var{prop_name}) |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
24 ## @deftypefnx {Function File} {@var{h} =} findobj ("-regexp", @var{prop_name}, @var{pattern}) |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
25 ## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, @dots{}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
26 ## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "flat", @dots{}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
27 ## @deftypefnx {Function File} {@var{h} =} findobj (@var{hlist}, "-depth", @var{d}, @dots{}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
28 ## Find graphics object with specified property values. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
29 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
30 ## The simplest form is |
6935 | 31 ## |
32 ## @example | |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
33 ## findobj (@var{prop_name}, @var{prop_value}) |
6935 | 34 ## @end example |
35 ## | |
36 ## @noindent | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
37 ## which returns the handles of all objects which have a property named |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
38 ## @var{prop_name} that has the value @var{prop_value}. If multiple |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
39 ## property/value pairs are specified then only objects meeting all of the |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
40 ## conditions are returned. |
6935 | 41 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
42 ## The search can be limited to a particular set of objects and their |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
43 ## descendants, by passing a handle or set of handles @var{hlist} as the first |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
44 ## argument. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
45 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
46 ## The depth of the object hierarchy to search can be limited with the "-depth" |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
47 ## argument. An example of searching only three generations of children is: |
6935 | 48 ## |
49 ## @example | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
50 ## findobj (@var{hlist}, "-depth", @var{d}, @var{prop_name}, @var{prop_value}) |
6935 | 51 ## @end example |
52 ## | |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
53 ## Specifying a depth @var{d} of 0, limits the search to the set of objects |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
54 ## passed in @var{hlist}. A depth @var{d} of 0 is equivalent to the "flat" |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
55 ## argument. |
6935 | 56 ## |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
57 ## A specified logical operator may be applied to the pairs of @var{prop_name} |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
58 ## and @var{prop_value}. The supported logical operators are: "-and", "-or", |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
59 ## "-xor", "-not". |
6935 | 60 ## |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
61 ## Objects may also be matched by comparing a regular expression to the |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
62 ## property values, where property values that match |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
63 ## @code{regexp (@var{prop_value}, @var{pattern})} are returned. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
64 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
65 ## Finally, objects may be matched by property name only by using the |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
66 ## "-property" option. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
67 ## |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
68 ## Implementation Note: The search only includes objects with visible |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
69 ## handles ("HandleVisibility" = "on"). @xref{XREFfindall,,findall}, to |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
70 ## search for all objects including hidden ones. |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
17119
diff
changeset
|
71 ## @seealso{findall, allchild, get, set} |
6935 | 72 ## @end deftypefn |
73 | |
7017 | 74 ## Author: Ben Abbott <bpabbott@mac.com> |
75 | |
6935 | 76 function h = findobj (varargin) |
77 | |
78 depth = NaN; | |
79 if (nargin == 0) | |
80 handles = 0; | |
81 n1 = 0; | |
82 else | |
8265
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
83 if (! isempty (varargin{1})) |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
84 if (ishandle (varargin{1}(1))) |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
85 handles = varargin{1}; |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
86 n1 = 2; |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
87 else |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
88 handles = 0; |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
89 n1 = 1; |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
90 endif |
6935 | 91 else |
8265
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
92 ## Return [](0x1) for compatibility. |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
93 h = zeros (0, 1); |
1c213dff76fc
findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents:
8190
diff
changeset
|
94 return; |
7151 | 95 endif |
6935 | 96 if (n1 <= nargin) |
97 if (ischar (varargin{n1})) | |
10549 | 98 if (strcmpi (varargin{n1}, "flat")) |
99 depth = 0; | |
100 n1 = n1 + 1; | |
101 elseif (strcmpi (varargin{n1}, "-depth")) | |
102 depth = varargin{n1+1}; | |
103 n1 = n1 + 2; | |
104 endif | |
6935 | 105 else |
10549 | 106 error ("findobj: properties and options must be strings"); |
6935 | 107 endif |
108 endif | |
109 endif | |
110 | |
111 if (n1 <= nargin && nargin > 0) | |
112 args = varargin(n1 : nargin); | |
113 else | |
114 args = {}; | |
115 endif | |
116 | |
117 regularexpression = []; | |
118 property = []; | |
119 logicaloperator = {}; | |
120 pname = {}; | |
121 pvalue = {}; | |
122 np = 1; | |
123 na = 1; | |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
124 operatorprecedence = {"-not", "-and", "-or", "-xor"}; |
6935 | 125 |
126 while (na <= numel (args)) | |
127 regularexpression(np) = 0; | |
128 property(np) = 0; | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7208
diff
changeset
|
129 logicaloperator{np} = "and"; |
7208 | 130 if (ischar (args{na})) |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7208
diff
changeset
|
131 if (strcmpi (args{na}, "-regexp")) |
10549 | 132 if (na + 2 <= numel (args)) |
133 regularexpression(np) = 1; | |
134 na = na + 1; | |
135 pname{np} = args{na}; | |
136 na = na + 1; | |
137 pvalue{np} = args{na}; | |
138 na = na + 1; | |
139 np = np + 1; | |
140 else | |
141 error ("findobj: inconsistent number of arguments"); | |
142 endif | |
8190
73d6b71788c0
use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents:
7208
diff
changeset
|
143 elseif (strcmpi (args{na}, "-property")) |
10549 | 144 if (na + 1 <= numel (args)) |
145 na = na + 1; | |
146 property(np) = 1; | |
147 pname{np} = args{na}; | |
148 na = na + 1; | |
149 pvalue{np} = []; | |
150 np = np + 1; | |
151 else | |
152 error ("findobj: inconsistent number of arguments"); | |
153 endif | |
8506 | 154 elseif (! strcmp (args{na}(1), "-")) |
10549 | 155 ## Parameter/value pairs. |
156 if (na + 1 <= numel (args)) | |
157 pname{np} = args{na}; | |
158 na = na + 1; | |
159 pvalue{np} = args{na}; | |
160 na = na + 1; | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
161 if (na <= numel (args)) |
10549 | 162 if (ischar (args{na})) |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
163 if (any (strcmpi (args{na}, operatorprecedence))) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
164 logicaloperator{np} = args{na}(2:end); |
10549 | 165 na = na+1; |
166 endif | |
167 else | |
168 error ("findobj: properties and options must be strings"); | |
169 endif | |
170 else | |
171 logicaloperator{np} = "and"; | |
172 endif | |
173 np = np + 1; | |
174 else | |
175 error ("findobj: inconsistent number of arguments"); | |
176 endif | |
6935 | 177 else |
10549 | 178 ## This is sloppy ... but works like Matlab. |
14552
86854d032a37
maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents:
14327
diff
changeset
|
179 if (strcmpi (args{na}, "-not")) |
10549 | 180 h = []; |
181 return | |
182 endif | |
183 na = na + 1; | |
6935 | 184 endif |
185 else | |
186 error ("findobj: properties and options must be strings"); | |
187 endif | |
188 endwhile | |
189 | |
190 numpairs = np - 1; | |
16673 | 191 if (~ isempty (logicaloperator)) |
192 logicaloperator = shift (logicaloperator, 1); | |
193 endif | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
194 |
8506 | 195 ## Load all objects which qualify for being searched. |
6935 | 196 idepth = 0; |
197 h = handles; | |
198 while (numel (handles) && ! (idepth >= depth)) | |
199 children = []; | |
200 for n = 1 : numel (handles) | |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
201 children = union (children, get (handles(n), "children")); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
202 endfor |
6935 | 203 handles = children; |
204 h = union (h, children); | |
205 idepth = idepth + 1; | |
206 endwhile | |
207 | |
208 if (numpairs > 0) | |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
209 match = true (numel (h), numpairs); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14552
diff
changeset
|
210 for nh = 1 : numel (h) |
16897
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
211 p = get (h(nh)); |
6935 | 212 for np = 1 : numpairs |
10549 | 213 fields = fieldnames (p); |
214 fieldindex = find (strcmpi (fields, pname{np}), 1); | |
215 if (numel (fieldindex)) | |
6935 | 216 pname{np} = fields{fieldindex}; |
217 if (property(np)) | |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
218 match(nh,np) = true; |
6935 | 219 else |
220 if (regularexpression(np)) | |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
221 foo = regexp (p.(pname{np}), pvalue{np}, "once"); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
222 if (isempty (foo)) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
223 match(nh,np) = false; |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
224 else |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
225 match(nh,np) = foo; |
7151 | 226 endif |
6935 | 227 elseif (numel (p.(pname{np})) == numel (pvalue{np})) |
16895
b8c37a855074
Modify findobj() to work with cells and structures.
Ben Abbott <bpabbott@mac.com>
parents:
16673
diff
changeset
|
228 if (ischar (pvalue{np}) && ischar (p.(pname{np}))) |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
229 match(nh,np) = strcmpi (pvalue{np}, p.(pname{np})); |
16895
b8c37a855074
Modify findobj() to work with cells and structures.
Ben Abbott <bpabbott@mac.com>
parents:
16673
diff
changeset
|
230 elseif (isnumeric (pvalue{np} && isnumeric (p.(pname{np})))) |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
231 match(nh,np) = (pvalue{np} == p.(pname{np})); |
10549 | 232 else |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
233 match(nh,np) = isequal (pvalue{np}, p.(pname{np})); |
10549 | 234 endif |
6935 | 235 else |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
236 match(nh,np) = false; |
6935 | 237 endif |
238 endif | |
10549 | 239 else |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
240 match(nh,np) = false; |
10549 | 241 endif |
6935 | 242 endfor |
243 endfor | |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
244 |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
245 if (numpairs > 1) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
246 for no = 1 : numel (operatorprecedence) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
247 pairs = find (strcmp (logicaloperator(2:end), ... |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
248 operatorprecedence{no}(2:end))); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
249 for np = sort (pairs, "descend") |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
250 if (no == 1) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
251 match(:,np+1) = ! match(:,np+1); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
252 logicaloperator(np+1) = {"and"}; |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
253 else |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
254 match(:,np) = feval (logicaloperator{np+1}, match(:,np), ... |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
255 match(:,np+1)); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
256 logicaloperator(np+1) = []; |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
257 match(:,np+1) = []; |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
258 numpairs = numpairs - 1; |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
259 endif |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
260 if (numpairs < 2) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
261 break; |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
262 endif |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
263 endfor |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
264 if (numpairs < 2) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
265 break; |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
266 endif |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
267 endfor |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
268 endif |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
269 else |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
270 match = true (numel (h), 1); |
6935 | 271 endif |
272 | |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
273 h = h(match); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
274 h = h(:); |
6935 | 275 endfunction |
13096 | 276 |
16673 | 277 %!test |
278 %! hf = figure ("visible", "off"); | |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
279 %! clf (hf); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
280 %! unwind_protect |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
281 %! h = findobj (gca (), "-property", "foo"); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
282 %! assert (h, zeros (0, 1)) |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
283 %! unwind_protect_cleanup |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
284 %! close (hf); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
285 %! end_unwind_protect |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
286 |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
287 %!test |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
288 %! hf = figure ("visible", "off"); |
16673 | 289 %! unwind_protect |
290 %! h = plot (1:10); | |
291 %! set (h, "tag", "foobar") | |
292 %! g = findobj (gcf (), "tag", "foobar", "type", "line", "color", [0 0 1]); | |
293 %! assert (g, h) | |
294 %! unwind_protect_cleanup | |
295 %! close (hf); | |
296 %! end_unwind_protect | |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
297 |
13096 | 298 %!test |
13124
2ea1658ad049
Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents:
13111
diff
changeset
|
299 %! hf = figure ("visible", "off"); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13124
diff
changeset
|
300 %! unwind_protect |
13096 | 301 %! l = line; |
13111
ebb42fb2da04
Various fixes for tests in scripts/plot
Kai Habel <kai.habel@gmx.de>
parents:
13096
diff
changeset
|
302 %! obj = findobj (hf, "type", "line"); |
13096 | 303 %! assert (l, obj); |
13111
ebb42fb2da04
Various fixes for tests in scripts/plot
Kai Habel <kai.habel@gmx.de>
parents:
13096
diff
changeset
|
304 %! assert (gca, findobj (hf, "type", "axes")); |
13124
2ea1658ad049
Don't use explicit figure number for tests to avoid interference with any figures opened by user.
Kai Habel <kai.habel@gmx.de>
parents:
13111
diff
changeset
|
305 %! assert (hf, findobj (hf, "type", "figure")); |
13111
ebb42fb2da04
Various fixes for tests in scripts/plot
Kai Habel <kai.habel@gmx.de>
parents:
13096
diff
changeset
|
306 %! assert (isempty (findobj (hf, "type", "xyzxyz"))); |
13096 | 307 %! unwind_protect_cleanup |
308 %! close (hf); | |
309 %! end_unwind_protect | |
14001
5f0bb45e615c
doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents:
13141
diff
changeset
|
310 |
16673 | 311 %!test |
312 %! hf = figure ("visible", "off"); | |
313 %! unwind_protect | |
314 %! subplot (2, 2, 1) | |
315 %! imagesc (rand (10)) | |
316 %! subplot (2, 2, 2) | |
317 %! surf (peaks) | |
318 %! subplot (2, 2, 3) | |
319 %! contour (peaks) | |
320 %! subplot (2, 2, 4) | |
321 %! plot (peaks) | |
322 %! h1 = findobj (gcf (), "-regexp", "Type", "image|surface|hggroup"); | |
323 %! h2 = findobj (gcf (), "Type", "image", "-or", "Type", "surface", "-or", "Type", "hggroup"); | |
324 %! unwind_protect_cleanup | |
325 %! close (hf); | |
326 %! end_unwind_protect | |
327 %! assert (h2, h1) | |
328 | |
16895
b8c37a855074
Modify findobj() to work with cells and structures.
Ben Abbott <bpabbott@mac.com>
parents:
16673
diff
changeset
|
329 %!test |
17107
dbd64c9a16da
Restore graphics toolkit after %!tests that alter it.
Rik <rik@octave.org>
parents:
16905
diff
changeset
|
330 %! toolkit = graphics_toolkit ("gnuplot"); |
17119
bd50e0660545
test: Add missing semicolons to suppress output in some plot %!tests.
Rik <rik@octave.org>
parents:
17107
diff
changeset
|
331 %! hf = figure ("visible", "off"); |
16897
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
332 %! unwind_protect |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
333 %! h1 = subplot (2, 2, 1); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
334 %! h2 = subplot (2, 2, 2); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
335 %! h3 = subplot (2, 2, 3); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
336 %! h4 = subplot (2, 2, 4); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
337 %! userdata = struct ("foo", "bar"); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
338 %! set (h3, "userdata", userdata); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
339 %! h = findobj (hf, "userdata", userdata); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
340 %! unwind_protect_cleanup |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
341 %! close (hf); |
17107
dbd64c9a16da
Restore graphics toolkit after %!tests that alter it.
Rik <rik@octave.org>
parents:
16905
diff
changeset
|
342 %! graphics_toolkit (toolkit); |
16897
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
343 %! end_unwind_protect |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
344 %! assert (h, h3) |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
345 |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
346 %!test |
17107
dbd64c9a16da
Restore graphics toolkit after %!tests that alter it.
Rik <rik@octave.org>
parents:
16905
diff
changeset
|
347 %! toolkit = graphics_toolkit ("gnuplot"); |
17119
bd50e0660545
test: Add missing semicolons to suppress output in some plot %!tests.
Rik <rik@octave.org>
parents:
17107
diff
changeset
|
348 %! hf = figure ("visible", "off"); |
16897
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
349 %! unwind_protect |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
350 %! h1 = subplot (2, 2, 1); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
351 %! set (h1, 'tag', '1') |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
352 %! h2 = subplot (2, 2, 2); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
353 %! set (h2, 'tag', '2') |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
354 %! h3 = subplot (2, 2, 3); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
355 %! set (h3, 'tag', '3') |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
356 %! h4 = subplot (2, 2, 4); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
357 %! set (h4, 'tag', '4') |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
358 %! h = findobj (hf, 'type', 'axes', '-not', 'tag', '1'); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
359 %! unwind_protect_cleanup |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
360 %! close (hf); |
17107
dbd64c9a16da
Restore graphics toolkit after %!tests that alter it.
Rik <rik@octave.org>
parents:
16905
diff
changeset
|
361 %! graphics_toolkit (toolkit); |
16897
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
362 %! end_unwind_protect |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
363 %! assert (h, [h2; h3; h4]) |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
364 |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
365 %!test |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
366 %! hf = figure ("visible", "off"); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
367 %! unwind_protect |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
368 %! h1 = subplot (2, 2, 1); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
369 %! set (h1, 'userdata', struct ('column', 1, 'row', 1)); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
370 %! h2 = subplot (2, 2, 2); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
371 %! set (h2, 'userdata', struct ('column', 2, 'row', 1)); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
372 %! h3 = subplot (2, 2, 3); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
373 %! set (h3, 'userdata', struct ('column', 1, 'row', 2)); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
374 %! h4 = subplot (2, 2, 4); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
375 %! set (h4, 'userdata', struct ('column', 2, 'row', 2)); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
376 %! h = findobj (hf, 'type', 'axes', '-not', 'userdata', ... |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
377 %! struct ('column', 1, 'row', 1)); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
378 %! unwind_protect_cleanup |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
379 %! close (hf); |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
380 %! end_unwind_protect |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
381 %! assert (h, [h2; h3; h4]) |
21d5e76891fe
Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
16895
diff
changeset
|
382 |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
383 %!test |
16900
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
384 %! hf = figure ("visible", "off"); |
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
385 %! unwind_protect |
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
386 %! ha = axes (); |
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
387 %! plot (1:10); |
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
388 %! h = findobj (hf, 'type', 'figure', ... |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
389 %! '-or', 'parent', hf, ... |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
390 %! '-and', 'type', 'axes'); |
16900
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
391 %! unwind_protect_cleanup |
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
392 %! close (hf) |
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
393 %! end_unwind_protect |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
394 %! assert (h, [ha; hf]) |
16900
434a0b29ab12
Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents:
16897
diff
changeset
|
395 |
16905
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
396 %!test |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
397 %! hf = figure ("visible", "off"); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
398 %! set (hf, 'tag', 'foo'); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
399 %! unwind_protect |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
400 %! h1 = subplot (2, 2, 1); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
401 %! set (h1, 'tag', 'foo'); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
402 %! h2 = subplot (2, 2, 2); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
403 %! set (h2, 'tag', 'bar'); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
404 %! h3 = subplot (2, 2, 3); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
405 %! set (h3, 'tag', 'foo'); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
406 %! h4 = subplot (2, 2, 4); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
407 %! set (h4, 'tag', 'bar') |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
408 %! h = findobj (hf, 'type', 'axes', '-xor', ... |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
409 %! 'tag', 'foo'); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
410 %! unwind_protect_cleanup |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
411 %! close (hf); |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
412 %! end_unwind_protect |
562301c71bd3
Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents:
16900
diff
changeset
|
413 %! assert (h, [h2; h4; hf]) |