annotate scripts/plot/util/findobj.m @ 20524:ba4088aee342

findobj.m: Stop requiring gnuplot in BIST tests (bug #36983). * findobj.m: Remove explicit code to set toolkit to gnuplot and restore existing toolkit at end of BIST test.
author Rik <rik@octave.org>
date Sun, 13 Sep 2015 14:47:58 -0700
parents 83792dd9bcc1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19399
diff changeset
1 ## Copyright (C) 2007-2015 Ben Abbott
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
2 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
3 ## This file is part of Octave.
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
4 ##
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
6 ## under the terms of the GNU General Public License as published by
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
8 ## your option) any later version.
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
9 ##
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
13 ## General Public License for more details.
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
14 ##
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 7001
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
18
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
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
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
31 ##
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
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
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
34 ## @end example
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
35 ##
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
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
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
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 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
46 ## The depth of the object hierarchy to search can be limited with the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
47 ## @qcode{"-depth"} argument. An example of searching only three generations
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
48 ## of children is:
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
49 ##
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
50 ## @example
17478
0ad2f93fd83c doc: Fix a typo in findobj docstring.
Rik <rik@octave.org>
parents: 17312
diff changeset
51 ## findobj (@var{hlist}, "-depth", 3, @var{prop_name}, @var{prop_value})
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
52 ## @end example
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
53 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
54 ## Specifying a depth @var{d} of 0, limits the search to the set of objects
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
55 ## passed in @var{hlist}. A depth @var{d} of 0 is equivalent to the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
56 ## @qcode{"flat"} argument.
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
57 ##
14327
4d917a6a858b doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
58 ## A specified logical operator may be applied to the pairs of @var{prop_name}
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
59 ## and @var{prop_value}. The supported logical operators are:
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
60 ## @qcode{"-and"}, @qcode{"-or"},
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
61 ## @qcode{"-xor"}, @qcode{"-not"}.
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
62 ##
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
63 ## 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
64 ## property values, where property values that match
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
65 ## @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
66 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
67 ## Finally, objects may be matched by property name only by using the
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
68 ## @qcode{"-property"} option.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
69 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
70 ## Implementation Note: The search only includes objects with visible
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17238
diff changeset
71 ## handles (HandleVisibility = @qcode{"on"}). @xref{XREFfindall,,findall}, to
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
72 ## search for all objects including hidden ones.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
73 ## @seealso{findall, allchild, get, set}
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
74 ## @end deftypefn
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
75
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
76 ## Author: Ben Abbott <bpabbott@mac.com>
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
77
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
78 function h = findobj (varargin)
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
79
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
80 depth = NaN;
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
81 if (nargin == 0)
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
82 handles = 0;
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
83 n1 = 0;
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
84 else
8265
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
85 if (! isempty (varargin{1}))
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
86 if (ishandle (varargin{1}(1)))
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
87 handles = varargin{1};
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
88 n1 = 2;
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
89 else
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
90 handles = 0;
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
91 n1 = 1;
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
92 endif
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
93 else
8265
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
94 ## Return [](0x1) for compatibility.
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
95 h = zeros (0, 1);
1c213dff76fc findobj.m: allow handle to be empty
Ben Abbott <bpabbott@mac.com>
parents: 8190
diff changeset
96 return;
7151
aeeb646f6538 [project @ 2007-11-09 19:34:17 by jwe]
jwe
parents: 7017
diff changeset
97 endif
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
98 if (n1 <= nargin)
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
99 if (ischar (varargin{n1}))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
100 if (strcmpi (varargin{n1}, "flat"))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
101 depth = 0;
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
102 n1 += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
103 endif
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
104 else
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
105 error ("findobj: properties and options must be strings");
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
106 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
107 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
108 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
109
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
110 if (n1 <= nargin && nargin > 0)
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
111 args = varargin(n1 : nargin);
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
112 else
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
113 args = {};
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
114 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
115
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
116 regularexpression = [];
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
117 property = [];
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
118 logicaloperator = {};
18507
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
119 extranegation = [];
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
120 pname = {};
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
121 pvalue = {};
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
122 np = 1;
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
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
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
125
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
126 while (na <= numel (args))
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
127 regularexpression(np) = 0;
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
128 property(np) = 0;
18507
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
129 if (numel (extranegation) < np)
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
130 extranegation(np) = false;
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
131 endif
8190
73d6b71788c0 use case-insensitive comparison for graphics properties; misc style fixes
John W. Eaton <jwe@octave.org>
parents: 7208
diff changeset
132 logicaloperator{np} = "and";
7208
a730e47fda4d [project @ 2007-11-28 02:32:41 by jwe]
jwe
parents: 7151
diff changeset
133 if (ischar (args{na}))
19399
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
134 if (strcmpi (args{na}, "-property"))
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
135 if (na + 1 <= numel (args))
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
136 na += 1;
19399
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
137 property(np) = 1;
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
138 pname{np} = args{na};
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
139 na += 1;
19399
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
140 pvalue{np} = [];
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
141 np += 1;
19399
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
142 else
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
143 error ("findobj: inconsistent number of arguments");
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
144 endif
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
145 elseif (strcmpi (args{na}, "-regexp"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
146 if (na + 2 <= numel (args))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
147 regularexpression(np) = 1;
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
148 na += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
149 pname{np} = args{na};
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
150 na += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
151 pvalue{np} = args{na};
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
152 na += 1;
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
153 np += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
154 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
155 error ("findobj: inconsistent number of arguments");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
156 endif
19399
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
157 elseif (strcmpi (args{na}, "-depth"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
158 if (na + 1 <= numel (args))
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
159 na += 1;
19399
c446da1da9ff findobj.m: Allow -depth argument anywhere in input arg list (bug #43136).
Rik <rik@octave.org>
parents: 18507
diff changeset
160 depth = args{na};
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
161 na += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
162 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
163 error ("findobj: inconsistent number of arguments");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
164 endif
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8265
diff changeset
165 elseif (! strcmp (args{na}(1), "-"))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
166 ## Parameter/value pairs.
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
167 if (na + 1 <= numel (args))
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
168 pname{np} = args{na};
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
169 na += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
170 pvalue{np} = args{na};
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
171 na += 1;
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14552
diff changeset
172 if (na <= numel (args))
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
173 if (ischar (args{na}))
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
174 if (any (strcmpi (args{na}, operatorprecedence)))
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
175 logicaloperator{np} = args{na}(2:end);
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
176 na += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
177 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
178 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
179 error ("findobj: properties and options must be strings");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
180 endif
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
181 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
182 logicaloperator{np} = "and";
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
183 endif
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
184 np += 1;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
185 else
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
186 error ("findobj: inconsistent number of arguments");
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
187 endif
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
188 else
14552
86854d032a37 maint: miscellaneous style fixes for .m files
John W. Eaton <jwe@octave.org>
parents: 14327
diff changeset
189 if (strcmpi (args{na}, "-not"))
18507
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
190 extranegation(np) = true;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
191 endif
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
192 na += 1;
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
193 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
194 else
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
195 error ("findobj: properties and options must be strings");
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
196 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
197 endwhile
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
198
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
199 numpairs = np - 1;
17307
4448cc742880 Use '!' not operator rather than '~' in core m-files.
Rik <rik@octave.org>
parents: 17281
diff changeset
200 if (! isempty (logicaloperator))
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
201 logicaloperator = shift (logicaloperator, 1);
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
202 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
203
8506
bc982528de11 comment style fixes
John W. Eaton <jwe@octave.org>
parents: 8265
diff changeset
204 ## Load all objects which qualify for being searched.
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
205 idepth = 0;
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
206 h = handles;
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
207 while (numel (handles) && ! (idepth >= depth))
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
208 children = [];
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
209 for n = 1 : numel (handles)
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
210 children = [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
211 endfor
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
212 handles = children;
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
213 h = [h; children];
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
214 idepth += 1;
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
215 endwhile
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
216
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
217 if (numpairs > 0)
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
218 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
219 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
220 p = get (h(nh));
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
221 for np = 1 : numpairs
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
222 fields = fieldnames (p);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
223 fieldindex = find (strcmpi (fields, pname{np}), 1);
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
224 if (numel (fieldindex))
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
225 pname{np} = fields{fieldindex};
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
226 if (property(np))
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
227 match(nh,np) = true;
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
228 else
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
229 if (regularexpression(np))
20015
ed53c87050e8 findobj.m: Stop warning message when using -regexp option (bug #44610).
Rik <rik@octave.org>
parents: 19731
diff changeset
230 found = regexp (p.(pname{np}), pvalue{np}, "once");
ed53c87050e8 findobj.m: Stop warning message when using -regexp option (bug #44610).
Rik <rik@octave.org>
parents: 19731
diff changeset
231 if (isempty (found))
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
232 match(nh,np) = false;
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
233 else
20015
ed53c87050e8 findobj.m: Stop warning message when using -regexp option (bug #44610).
Rik <rik@octave.org>
parents: 19731
diff changeset
234 match(nh,np) = true;
7151
aeeb646f6538 [project @ 2007-11-09 19:34:17 by jwe]
jwe
parents: 7017
diff changeset
235 endif
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
236 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
237 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
238 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
239 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
240 match(nh,np) = (pvalue{np} == p.(pname{np}));
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
241 else
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
242 match(nh,np) = isequal (pvalue{np}, p.(pname{np}));
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
243 endif
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
244 else
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
245 match(nh,np) = false;
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
246 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
247 endif
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
248 else
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
249 match(nh,np) = false;
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9040
diff changeset
250 endif
18507
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
251 if (extranegation(np))
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
252 match(nh,np) = ! match(nh,np);
dca6ecfd622c findobj.m: let leading negation work (bug #41588).
Sergey Plotnikov <seryozha.plotnikov@gmail.com>
parents: 17744
diff changeset
253 endif
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
254 endfor
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
255 endfor
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
256
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
257 if (numpairs > 1)
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
258 for no = 1 : numel (operatorprecedence)
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
259 pairs = find (strcmp (logicaloperator(2:end), ...
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
260 operatorprecedence{no}(2:end)));
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
261 for np = sort (pairs, "descend")
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
262 if (no == 1)
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
263 match(:,np+1) = ! match(:,np+1);
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
264 logicaloperator(np+1) = {"and"};
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
265 else
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
266 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
267 match(:,np+1));
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
268 logicaloperator(np+1) = [];
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
269 match(:,np+1) = [];
20266
83792dd9bcc1 Use in-place operators in m-files where possible.
Rik <rik@octave.org>
parents: 20015
diff changeset
270 numpairs -= 1;
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
271 endif
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
272 if (numpairs < 2)
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
273 break;
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
274 endif
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
275 endfor
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
276 if (numpairs < 2)
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
277 break;
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
278 endif
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
279 endfor
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
280 endif
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
281 else
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
282 match = true (numel (h), 1);
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
283 endif
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
284
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
285 h = h(match);
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
286 h = h(:);
6935
5cd272497aae [project @ 2007-09-30 19:16:49 by dbateman]
dbateman
parents:
diff changeset
287 endfunction
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
288
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
289
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
290 %!test
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
291 %! hf = figure ("visible", "off");
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
292 %! unwind_protect
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
293 %! h = findobj (gca (), "-property", "foo");
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
294 %! assert (isempty (h));
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
295 %! unwind_protect_cleanup
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
296 %! close (hf);
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
297 %! end_unwind_protect
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
298
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
299 %!test
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
300 %! hf = figure ("visible", "off");
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
301 %! unwind_protect
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
302 %! h = plot (1:10);
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
303 %! set (h, "tag", "foobar");
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
304 %! g = findobj (gcf (), "tag", "foobar", "type", "line", "color", [0 0 1]);
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
305 %! assert (g, h);
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
306 %! unwind_protect_cleanup
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
307 %! close (hf);
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
308 %! 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
309
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
310 %!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
311 %! 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
312 %! unwind_protect
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
313 %! l = line;
13111
ebb42fb2da04 Various fixes for tests in scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 13096
diff changeset
314 %! obj = findobj (hf, "type", "line");
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
315 %! assert (l, obj);
13111
ebb42fb2da04 Various fixes for tests in scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 13096
diff changeset
316 %! 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
317 %! 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
318 %! assert (isempty (findobj (hf, "type", "xyzxyz")));
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
319 %! unwind_protect_cleanup
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
320 %! close (hf);
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11587
diff changeset
321 %! 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
322
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
323 %!test
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
324 %! hf = figure ("visible", "off");
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
325 %! unwind_protect
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
326 %! subplot (2,2,1);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
327 %! imagesc (rand (10));
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
328 %! subplot (2,2,2);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
329 %! surf (peaks);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
330 %! subplot (2,2,3);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
331 %! contour (peaks);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
332 %! subplot (2,2,4);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
333 %! plot (peaks);
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
334 %! h1 = findobj (gcf (), "-regexp", "Type", "image|surface|hggroup");
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
335 %! h2 = findobj (gcf (), "Type", "image",
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
336 %! "-or", "Type", "surface",
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
337 %! "-or", "Type", "hggroup");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
338 %! assert (h2, h1);
16673
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
339 %! unwind_protect_cleanup
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
340 %! close (hf);
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
341 %! end_unwind_protect
092d0a685546 Fix bug # 38885.
Ben Abbott <bpabbott@mac.com>
parents: 14868
diff changeset
342
16895
b8c37a855074 Modify findobj() to work with cells and structures.
Ben Abbott <bpabbott@mac.com>
parents: 16673
diff changeset
343 %!test
17119
bd50e0660545 test: Add missing semicolons to suppress output in some plot %!tests.
Rik <rik@octave.org>
parents: 17107
diff changeset
344 %! 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
345 %! unwind_protect
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
346 %! h1 = subplot (2,2,1);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
347 %! h2 = subplot (2,2,2);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
348 %! h3 = subplot (2,2,3, "userdata", struct ("foo", "bar"));
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
349 %! h4 = subplot (2,2,4);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
350 %! h = findobj (hf, "userdata", struct ("foo", "bar"));
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
351 %! assert (h, h3);
16897
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
352 %! unwind_protect_cleanup
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
353 %! close (hf);
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
354 %! end_unwind_protect
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
355
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
356 %!test
17119
bd50e0660545 test: Add missing semicolons to suppress output in some plot %!tests.
Rik <rik@octave.org>
parents: 17107
diff changeset
357 %! 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
358 %! unwind_protect
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
359 %! h1 = subplot (2,2,1, "tag", "1");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
360 %! h2 = subplot (2,2,2, "tag", "2");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
361 %! h3 = subplot (2,2,3, "tag", "3");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
362 %! h4 = subplot (2,2,4, "tag", "4");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
363 %! h = findobj (hf, "type", "axes", "-not", "tag", "1");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
364 %! assert (h, [h4; h3; h2])
16897
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
365 %! unwind_protect_cleanup
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
366 %! close (hf);
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
367 %! end_unwind_protect
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
368
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
369 %!test
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
370 %! hf = figure ("visible", "off");
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
371 %! unwind_protect
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
372 %! h1 = subplot (2, 2, 1);
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
373 %! set (h1, "userdata", struct ("column", 1, "row", 1));
16897
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
374 %! h2 = subplot (2, 2, 2);
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
375 %! set (h2, "userdata", struct ("column", 2, "row", 1));
16897
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
376 %! h3 = subplot (2, 2, 3);
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
377 %! set (h3, "userdata", struct ("column", 1, "row", 2));
16897
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
378 %! h4 = subplot (2, 2, 4);
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
379 %! set (h4, "userdata", struct ("column", 2, "row", 2));
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
380 %! h = findobj (hf, "type", "axes",
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
381 %! "-not", "userdata", struct ("column", 1, "row", 1));
16897
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
382 %! unwind_protect_cleanup
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
383 %! close (hf);
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
384 %! end_unwind_protect
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
385 %! assert (h, [h4; h3; h2])
16897
21d5e76891fe Fix typo/bug for "-not" qualifier in findobj(). Add tests.
Ben Abbott <bpabbott@mac.com>
parents: 16895
diff changeset
386
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
387 %!test
16900
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
388 %! hf = figure ("visible", "off");
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
389 %! unwind_protect
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
390 %! ha = axes ();
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
391 %! plot (1:10);
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
392 %! h = findobj (hf, "type", "figure",
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
393 %! "-or", "parent", hf,
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
394 %! "-and", "type", "axes");
16900
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
395 %! unwind_protect_cleanup
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
396 %! close (hf)
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
397 %! end_unwind_protect
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
398 %! assert (h, [hf; ha])
16900
434a0b29ab12 Add xtest for findobj() for pecedence of logical operations.
Ben Abbott <bpabbott@mac.com>
parents: 16897
diff changeset
399
16905
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
400 %!test
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
401 %! hf = figure ("visible", "off");
562301c71bd3 Respect logical operator precedence for findobj()'s inputs.
Ben Abbott <bpabbott@mac.com>
parents: 16900
diff changeset
402 %! unwind_protect
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
403 %! set (hf, "tag", "foo");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
404 %! h1 = subplot (2,2,1, "tag", "foo");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
405 %! h2 = subplot (2,2,2, "tag", "bar");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
406 %! h3 = subplot (2,2,3, "tag", "foo");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
407 %! h4 = subplot (2,2,4, "tag", "bar");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
408 %! h = findobj (hf, "type", "axes", "-xor", "tag", "foo");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
409 %! assert (h, [hf; h4; h2]);
16905
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
17238
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
413
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
414 %!test
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
415 %! hf = figure ("visible", "off");
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
416 %! unwind_protect
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
417 %! hax1 = subplot (2,1,1);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
418 %! hl1 = plot (rand (10,1));
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
419 %! hax2 = subplot (2,1,2);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
420 %! hl2 = plot (rand (10,1));
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
421 %! hobj = findobj (hf);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
422 %! assert (hobj, [hf; hax2; hax1; hl2; hl1]);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
423 %! unwind_protect_cleanup
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
424 %! close (hf);
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
425 %! end_unwind_protect
3fd617363762 findobj.m: Return handles in hierarchy order rather than sorted order (bug #39767).
Rik <rik@octave.org>
parents: 17122
diff changeset
426