annotate scripts/plot/copyobj.m @ 15011:f34bea431e4f

maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m. * copyobj.m, hdl2struct.m, struct2hdl.m: Use Octave coding standards.
author Rik <rik@octave.org>
date Tue, 24 Jul 2012 13:41:41 -0700
parents 8f0e3c5bfa5f
children efbc896c1ecc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
1 ## Copyright (C) 2012 pdiribarne
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
2 ##
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
3 ## This program is free software; you can redistribute it and/or modify
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
4 ## it under the terms of the GNU General Public License as published by
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
5 ## the Free Software Foundation; either version 3 of the License, or
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
6 ## (at your option) any later version.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
7 ##
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
8 ## This program is distributed in the hope that it will be useful,
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
10 ## 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
11 ## 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
12 ##
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
13 ## 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
14 ## along with Octave; see the file COPYING. If not, see
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
15 ## <http://www.gnu.org/licenses/>.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
16
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
17 ## -*- texinfo -*-
15007
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
18 ## @deftypefn {Function File} {@var{hnew} =} copyobj (@var{horig})
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
19 ## @deftypefnx {Function File} {@var{hnew} =} copyobj (@var{horig}, @var{hparent})
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
20 ## Construct a copy of the object associated with handle @var{horig}
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
21 ## and return a handle @var{hnew} to the new object.
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
22 ## If a parent handle @var{hparent} (root, figure, axes, or hggroup) is
8f0e3c5bfa5f doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents: 14867
diff changeset
23 ## specified, the copied object will be created as a child to @var{hparent}.
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
24 ## @seealso{findobj, get, set, struct2hdl, hdl2struct}
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
25 ## @end deftypefn
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
26
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
27 ## Author: pdiribarne <pdiribarne@new-host.home>
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
28 ## Created: 2012-04-01
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
29
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
30 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
31
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
32 partypes = {"root", "figure", "axes", "hggroup"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
33 othertypes = {"line", "patch", "surface", "image", "text"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
34 alltypes = [partypes othertypes];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
35
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
36 if (! ishandle (horig) || nargin > 2)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
37 print_usage ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
38 elseif (! ishandle (hparent))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
39 hparent = figure (fix (hparent));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
40 elseif (! any (strcmpi (get (hparent).type, partypes)))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
41 print_usage ();
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
42 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
43
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
44 ## compatibility of input handles
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
45 kididx = find (strcmp (alltypes, get (horig).type));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
46 paridx = find (strcmp (alltypes, get (hparent).type));
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
47
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
48 if (kididx <= paridx)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
49 error ("copyobj: %s object can't be children to %s.",
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
50 alltypes{kididx}, alltypes{paridx});
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
51 elseif (nargin == 1)
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
52 str = hdl2struct (horig);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
53 hnew = struct2hdl (str);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
54 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
55 str = hdl2struct (horig);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
56 hnew = struct2hdl (str, hparent);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
57 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
58
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
59 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
60
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
61
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
62 %!demo
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
63 %! hdl = figure (1234);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
64 %! clf;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
65 %! hold on;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
66 %! x = 1:10;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
67 %! y = x.^2;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
68 %! 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
69 %! y2 = (x - 3).^2;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
70 %! hg = errorbar (x, y, dy,'#~');
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
71 %! set (hg, 'marker', '^', 'markerfacecolor', rand (1,3));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
72 %! plot (x, y2, 'ok-');
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
73 %! legend ('errorbar', 'line');
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
74 %! hnew = copyobj (hdl);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
75
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
76 %!demo
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
77 %! ## FIXME: This demo fails occasionally for an obscure reason.
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
78 %! ## It appears that there is something wrong with Octave code for patches.
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
79 %! hdl = figure (1234);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
80 %! clf;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
81 %! subplot (2,2,1);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
82 %! hold on;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
83 %! contourf (rand (10, 10));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
84 %! colorbar;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
85 %! subplot (2,2,2);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
86 %! quiver (rand (10, 10), rand (10, 10));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
87 %! subplot (2,2,3);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
88 %! colormap (jet (64));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
89 %! hold on;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
90 %! sombrero;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
91 %! colorbar ('peer', gca, 'NorthOutside');
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
92 %! subplot (2,2,4);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
93 %! imagesc (rand (30, 30));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
94 %! text (15, 15, 'Rotated text', ...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
95 %! 'HorizontAlalignment', 'Center', 'Rotation', 30);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
96 %! hnew = copyobj (hdl);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
97
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
98 %!test
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
99 %! h1 = figure ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
100 %! set (h1, "visible", "off");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
101 %! x = 0:0.1:2*pi;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
102 %! y1 = sin (x);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
103 %! y2 = exp (x - 1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
104 %! ax = plotyy (x,y1, x-1,y2, @plot, @semilogy);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
105 %! xlabel ("X");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
106 %! ylabel (ax(1), "Axis 1");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
107 %! ylabel (ax(2), "Axis 2");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
108 %! axes (ax(1));
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
109 %! text (0.5, 0.5, "Left Axis", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
110 %! "color", [0 0 1], "horizontalalignment", "center");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
111 %! axes (ax(2));
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
112 %! text (4.5, 80, "Right Axis", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
113 %! "color", [0 0.5 0], "horizontalalignment", "center");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
114 %! s1 = hdl2struct (h1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
115 %! h2 = struct2hdl (s1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
116 %! s2 = hdl2struct (h2);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
117 %! png1 = strcat (tmpnam (), ".png");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
118 %! png2 = strcat (tmpnam (), ".png");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
119 %! unwind_protect
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
120 %! print (h1, png1);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
121 %! [img1, map1, alpha1] = imread (png1);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
122 %! print (h2, png2);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
123 %! [img2, map2, alpha2] = imread (png2);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
124 %! unwind_protect_cleanup
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
125 %! unlink (png1);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
126 %! unlink (png2);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
127 %! end_unwind_protect
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
128 %! assert (img1, img2);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
129 %! assert (map1, map2);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
130 %! assert (alpha1, alpha2);