annotate scripts/plot/util/copyobj.m @ 29358:0a5b15007766 stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Feb 2021 09:52:15 -0500
parents f1dcb77ca6ff
children 7854d5752dd2 65f0754d9569
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 28681
diff changeset
3 ## Copyright (C) 2012-2021 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 27437
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
7 ##
17795
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
8 ## This file is part of Octave.
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24428
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24428
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
13 ## (at your option) any later version.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
14 ##
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
18 ## GNU General Public License for more details.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
19 ##
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24428
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
25
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19880
diff changeset
27 ## @deftypefn {} {@var{hnew} =} copyobj (@var{horig})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 19880
diff changeset
28 ## @deftypefnx {} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
29 ## Construct a copy of the graphic objects associated with the handles
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
30 ## @var{horig} and return new handles @var{hnew} to the new objects.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17006
diff changeset
31 ##
15007
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
32 ## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17006
diff changeset
33 ## specified, the copied object will be created as a child of @var{hparent}.
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
34 ##
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
35 ## If @var{horig} is a vector of handles, and @var{hparent} is a scalar,
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
36 ## then each handle in the vector @var{hnew} has its @qcode{"Parent"} property
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
37 ## set to @var{hparent}. Conversely, if @var{horig} is a scalar and
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
38 ## @var{hparent} a vector, then each parent object will receive a copy of
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
39 ## @var{horig}. If @var{horig} and @var{hparent} are both vectors with the
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
40 ## same number of elements then @code{@var{hnew}(i)} will have parent
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
41 ## @code{@var{hparent}(i)}.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17006
diff changeset
42 ## @seealso{struct2hdl, hdl2struct, findobj}
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
43 ## @end deftypefn
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
44
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
45 function hnew = copyobj (horig, hparent = 0)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
46
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
47 partypes = {"root", "figure", "axes", "hggroup"};
25973
c9ae077dedd1 New function openfig.m (bug #44670)
Guillaume Flandin <guillaume.offline@gmail.com>
parents: 25054
diff changeset
48 othertypes = {"line", "patch", "surface", "image", "text", "uicontrol"};
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
49 alltypes = [partypes othertypes];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
50
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 23508
diff changeset
51 if (! ishghandle (horig) || nargin > 2)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
52 print_usage ();
24423
1d52db450db4 Change ishandle to return true for Java objects for Matlab compatibility.
Rik <rik@octave.org>
parents: 23508
diff changeset
53 elseif (! ishghandle (hparent))
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
54 hparent = figure (fix (hparent));
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
55 else
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
56 for hp = hparent(:)'
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
57 if (! any (strcmpi (get (hp, "type"), partypes)))
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
58 print_usage ();
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
59 endif
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
60 endfor
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
61 endif
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
62
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
63 if (numel (horig) != numel (hparent)
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
64 && ! (isscalar (hparent) || isscalar (horig)))
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
65 error ("copyobj: size of HORIG and HPARENT must match, or one must be a scalar");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
66 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
67
15710
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
68 ## current figure and axes
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
69 cf = gcf ();
18558
5ec4b7006b82 copyobj.m: Fix bug when restoring axes to a figure that had no axes to begin with (bug #41849).
Rik <rik@octave.org>
parents: 18528
diff changeset
70 ca = get (cf, "currentaxes");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
71
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
72 ## compatibility of input handles
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
73 for i = 1:numel (horig)
21659
ff2347e1df02 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21658
diff changeset
74 kididx(i) = find (strcmp (alltypes, get (horig(i), "type")));
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
75 endfor
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
76
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
77 for i = 1:numel (hparent)
21659
ff2347e1df02 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 21658
diff changeset
78 paridx(i) = find (strcmp (alltypes, get (hparent(i), "type")));
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
79 endfor
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
80
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
81 if (kididx <= paridx)
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
82 error ("copyobj: %s object can't be a child of %s.",
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
83 alltypes{kididx}, alltypes{paridx});
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
84 endif
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
85
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
86 ## loop over vector inputs
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
87 if (nargin == 1)
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
88 ## No parent specified
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
89 for i = numel (horig)
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
90 str = hdl2struct (horig(i));
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
91 hnew(i) = struct2hdl (str);
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
92 endfor
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
93 elseif (isscalar (hparent))
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
94 for i = 1:numel (horig)
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
95 str = hdl2struct (horig(i));
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
96 hnew(i) = struct2hdl (str, hparent);
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
97 endfor
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
98 elseif (isscalar (horig))
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
99 str = hdl2struct (horig);
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
100 for i = 1:numel (hparent)
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
101 hnew(i) = struct2hdl (str, hparent(i));
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
102 endfor
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
103 else
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
104 for i = 1:numel (horig)
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
105 str = hdl2struct (horig(i));
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
106 hnew(i) = struct2hdl (str, hparent(i));
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
107 endfor
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
108 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
109
15710
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
110 ## reset current figure (and eventually axes) to original
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
111 set (0, "currentfigure", cf);
21626
1dda942a2514 copyobj.m: Allow input vectors for horig or hparent (bug #47694).
Rik <rik@octave.org>
parents: 21580
diff changeset
112 if (ancestor (hnew(1), "figure") == cf && ! isempty (ca))
21385
89fa0694aa2e Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents: 20852
diff changeset
113 set (cf, "currentaxes", ca);
15710
cd3d7f126190 copyobj.m: ensure gca() and gcf() are reset to original values
pantxo <pantxo.diribarne@gmail.com>
parents: 15328
diff changeset
114 endif
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17795
diff changeset
115
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
116 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
117
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
118
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
119 ## Absurd number of drawnow() function calls in demos is due to problem
28681
f1dcb77ca6ff maint: Use double quotes when getting/setting graphic properties per Octave convention.
Rik <rik@octave.org>
parents: 27985
diff changeset
120 ## with FLTK backend which is not respecting the set ("position") call.
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
121
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
122 %!demo
21658
2f9078956a63 don't open new figures unnecessarily in demos
John W. Eaton <jwe@octave.org>
parents: 21626
diff changeset
123 %! hobj = clf;
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
124 %! set (hobj, "name", "Original", "numbertitle", "off");
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
125 %! hold on;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
126 %! x = 1:10;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
127 %! y = x.^2;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
128 %! dy = 2 * (.2 * x);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
129 %! y2 = (x - 3).^2;
18924
9a5e03801d23 Update some plot %!demos so that they run under Matlab.
Rik <rik@octave.org>
parents: 18625
diff changeset
130 %! hg = errorbar (x, y, dy);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
131 %! set (hg, "marker", "^", "markerfacecolor", rand (1,3));
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
132 %! plot (x, y2, "ok-");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
133 %! legend ("errorbar", "line");
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
134 %! drawnow ();
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
135 %! pos = get (hobj, "position");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
136 %! scrn = get (0, "screensize");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
137 %! set (hobj, "position", [scrn(3)/2-pos(3)-10, scrn(4)/2-pos(4)/2, pos(3:4)]);
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
138 %! drawnow ();
26551
9728b61ef67e copyob.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26376
diff changeset
139 %! hnew = copyobj (hobj, groot);
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
140 %! drawnow ();
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
141 %! set (hnew, "name", "Copyobj");
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
142 %! drawnow ();
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
143 %! set (hnew, "position", [scrn(3)/2, scrn(4)/2-pos(4)/2, pos(3:4)]);
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
144 %! drawnow ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
145
18317
0187ed948627 Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents: 17795
diff changeset
146 %!demo
21658
2f9078956a63 don't open new figures unnecessarily in demos
John W. Eaton <jwe@octave.org>
parents: 21626
diff changeset
147 %! hobj = clf;
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
148 %! set (hobj, "name", "Original", "numbertitle", "off");
18317
0187ed948627 Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents: 17795
diff changeset
149 %! subplot (2,2,1);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
150 %! hold on;
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
151 %! contourf (rand (10, 10));
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
152 %! colorbar ();
18317
0187ed948627 Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents: 17795
diff changeset
153 %! subplot (2,2,2);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
154 %! quiver (rand (10, 10), rand (10, 10));
18317
0187ed948627 Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents: 17795
diff changeset
155 %! subplot (2,2,3);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
156 %! colormap (jet (64));
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
157 %! hold on;
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
158 %! sombrero ();
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
159 %! colorbar ("peer", gca, "NorthOutside");
18317
0187ed948627 Fix segfault with copyobj() and patch objects.
Rik <rik@octave.org>
parents: 17795
diff changeset
160 %! subplot (2,2,4);
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
161 %! imagesc (rand (30, 30));
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
162 %! text (15, 15, "Rotated text", ...
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
163 %! "HorizontAlalignment", "Center", "Rotation", 30);
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
164 %! drawnow ();
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
165 %! pos = get (hobj, "position");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
166 %! scrn = get (0, "screensize");
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
167 %! set (hobj, "position", [scrn(3)/2-pos(3)-10, scrn(4)/2-pos(4)/2, pos(3:4)]);
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
168 %! drawnow ();
26551
9728b61ef67e copyob.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26376
diff changeset
169 %! hnew = copyobj (hobj, groot);
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
170 %! drawnow ();
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
171 %! set (hnew, "name", "Copyobj");
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
172 %! drawnow ();
22302
1c4cd12987f5 Use Octave syntax in graphics demos.
Rik <rik@octave.org>
parents: 21659
diff changeset
173 %! set (hnew, "position", [scrn(3)/2, scrn(4)/2-pos(4)/2, pos(3:4)]);
18528
9c8321ea6f58 copyobj.m: Arrange original and copied plot side-by-side in demos.
Rik <rik@octave.org>
parents: 18317
diff changeset
174 %! drawnow ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
175
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
176 %!demo
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
177 %! hobj = clf;
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
178 %! set (hobj, "name", "Original", "numbertitle", "off");
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
179 %! x = 0:0.1:2*pi;
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
180 %! y1 = sin (x);
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
181 %! y2 = exp (x - 1);
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
182 %! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
183 %! xlabel ("X");
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
184 %! ylabel (ax(1), "Axis 1");
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
185 %! ylabel (ax(2), "Axis 2");
26553
4744a878c43f plotyy.m, copyobj.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26551
diff changeset
186 %! colororder = get (gca, "ColorOrder");
4744a878c43f plotyy.m, copyobj.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26551
diff changeset
187 %! lcolor = colororder(1,:);
4744a878c43f plotyy.m, copyobj.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26551
diff changeset
188 %! rcolor = colororder(2,:);
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
189 %! text (0.5, 0.5, "Left Axis", ...
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
190 %! "color", lcolor, "horizontalalignment", "center", "parent", ax(1));
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
191 %! text (4.5, 80, "Right Axis", ...
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
192 %! "color", rcolor, "horizontalalignment", "center", "parent", ax(2));
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
193 %! title ({"plotyy() example"; "left axis uses @plot, right axis uses @semilogy"});
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
194 %! drawnow ();
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
195 %! pos = get (hobj, "position");
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
196 %! scrn = get (0, "screensize");
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
197 %! set (hobj, "position", [scrn(3)/2-pos(3)-10, scrn(4)/2-pos(4)/2, pos(3:4)]);
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
198 %! drawnow ();
26551
9728b61ef67e copyob.m: Change %!demo code to run under Matlab (bug #55841).
Rik <rik@octave.org>
parents: 26376
diff changeset
199 %! hnew = copyobj (hobj, groot);
24428
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
200 %! drawnow ();
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
201 %! set (hnew, "name", "Copyobj");
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
202 %! drawnow ();
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
203 %! set (hnew, "position", [scrn(3)/2, scrn(4)/2-pos(4)/2, pos(3:4)]);
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
204 %! drawnow ();
3472c6760ad2 Update plotyy implementation.
Rik <rik@octave.org>
parents: 24423
diff changeset
205
23508
4b38c9687331 Skip tests that require gnuplot when gnuplot is not installed (bug #36983)
Mike Miller <mtmiller@octave.org>
parents: 23220
diff changeset
206 %!testif HAVE_MAGICK; any (strcmp ("gnuplot", available_graphics_toolkits ()))
17150
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
207 %! toolkit = graphics_toolkit ();
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
208 %! graphics_toolkit ("gnuplot");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
209 %! unwind_protect
27437
349504d42040 Fix regression in test suite caused by fix for bug #56916.
Rik <rik@octave.org>
parents: 26553
diff changeset
210 %! h1 = figure ("visible", "off", "paperposition", [0.25, 2.5, 8.0, 6.0]);
17150
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
211 %! x = 0:0.1:2*pi;
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
212 %! y1 = sin (x);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
213 %! y2 = exp (x - 1);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
214 %! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
215 %! xlabel ("X");
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
216 %! ylabel (ax(1), "Axis 1");
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
217 %! ylabel (ax(2), "Axis 2");
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
218 %! axes (ax(1));
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
219 %! text (0.5, 0.5, "Left Axis", ...
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
220 %! "color", [0 0 1], "horizontalalignment", "center");
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
221 %! axes (ax(2));
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
222 %! text (4.5, 80, "Right Axis", ...
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
223 %! "color", [0 0.5 0], "horizontalalignment", "center");
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
224 %! s1 = hdl2struct (h1);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
225 %! h2 = struct2hdl (s1);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
226 %! s2 = hdl2struct (h2);
19278
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 18924
diff changeset
227 %! png1 = [tempname() ".png"];
6ca096827123 Use tempname() rather than tmpnam() in core Octave.
Rik <rik@octave.org>
parents: 18924
diff changeset
228 %! png2 = [tempname() ".png"];
17150
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
229 %! unwind_protect
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
230 %! print (h1, png1);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
231 %! [img1, map1, alpha1] = imread (png1);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
232 %! print (h2, png2);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
233 %! [img2, map2, alpha2] = imread (png2);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
234 %! unwind_protect_cleanup
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
235 %! unlink (png1);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
236 %! unlink (png2);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
237 %! end_unwind_protect
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
238 %! assert (img1, img2);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
239 %! assert (map1, map2);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
240 %! assert (alpha1, alpha2);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
241 %! unwind_protect_cleanup
17150
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
242 %! close (h1);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
243 %! close (h2);
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
244 %! graphics_toolkit (toolkit);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
245 %! end_unwind_protect
17150
e7723410ec32 Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents: 17122
diff changeset
246
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
247 %!test
18625
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
248 %! unwind_protect
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
249 %! tag = "foo";
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
250 %! hf = figure ("visible", "off");
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
251 %! hax = axes ("tag", tag);
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
252 %! hpa = patch ();
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21385
diff changeset
253 %! set (hpa, "facecolor", [.5 .5 .5], "tag", tag);
18625
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
254 %! hax2 = copyobj (hax, hf);
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21385
diff changeset
255 %! assert (get (hax2, "tag"), tag);
18625
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
256 %! hpa2 = get (hax2, "children");
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21385
diff changeset
257 %! assert (get (hpa2, "facecolor"), [.5 .5 .5]);
18625
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
258 %! unwind_protect_cleanup
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21385
diff changeset
259 %! close (hf);
18625
ee125c82e01e struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 18558
diff changeset
260 %! end_unwind_protect