annotate scripts/plot/util/struct2hdl.m @ 17572:7bb76a22cde1

maint: Split scripts/plot directory into 4 pieces. scripts/gui : user-interface functions scripts/plot/appearance : functions controlling plot appearance scripts/plot/draw : plotting functions which produce graphs scripts/plot/util : low-level plotting functions and utilities. * scripts/gui/guidata.m, scripts/gui/guihandles.m, scripts/gui/module.mk, scripts/gui/private/__file_filter__.m, scripts/gui/private/__fltk_file_filter__.m, scripts/gui/private/__is_function__.m, scripts/gui/private/__uigetdir_fltk__.m, scripts/gui/private/__uigetfile_fltk__.m, scripts/gui/private/__uiobject_split_args__.m, scripts/gui/private/__uiputfile_fltk__.m, scripts/gui/uicontextmenu.m, scripts/gui/uicontrol.m, scripts/gui/uigetdir.m, scripts/gui/uigetfile.m, scripts/gui/uimenu.m, scripts/gui/uipanel.m, scripts/gui/uipushtool.m, scripts/gui/uiputfile.m, scripts/gui/uiresume.m, scripts/gui/uitoggletool.m, scripts/gui/uitoolbar.m, scripts/gui/uiwait.m, scripts/gui/waitbar.m, scripts/gui/waitforbuttonpress.m: Moved from scripts/plot to scripts/gui * scripts/plot/appearance/__clabel__.m, scripts/plot/appearance/__getlegenddata__.m, scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m, scripts/plot/appearance/caxis.m, scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m, scripts/plot/appearance/diffuse.m, scripts/plot/appearance/grid.m, scripts/plot/appearance/gtext.m, scripts/plot/appearance/hidden.m, scripts/plot/appearance/legend.m, scripts/plot/appearance/orient.m, scripts/plot/appearance/pbaspect.m, scripts/plot/appearance/private/__axis_label__.m, scripts/plot/appearance/private/__axis_limits__.m, scripts/plot/appearance/shading.m, scripts/plot/appearance/specular.m, scripts/plot/appearance/text.m, scripts/plot/appearance/title.m, scripts/plot/appearance/view.m, scripts/plot/appearance/whitebg.m, scripts/plot/appearance/xlabel.m, scripts/plot/appearance/xlim.m, scripts/plot/appearance/ylabel.m, scripts/plot/appearance/ylim.m, scripts/plot/appearance/zlabel.m, scripts/plot/appearance/zlim.m: Moved from scripts/plot to subdir appearance. * scripts/plot/draw/area.m, scripts/plot/draw/bar.m, scripts/plot/draw/barh.m, scripts/plot/draw/colorbar.m, scripts/plot/draw/comet.m, scripts/plot/draw/comet3.m, scripts/plot/draw/compass.m, scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m, scripts/plot/draw/contourc.m, scripts/plot/draw/contourf.m, scripts/plot/draw/cylinder.m, scripts/plot/draw/ellipsoid.m, scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m, scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m, scripts/plot/draw/ezmeshc.m, scripts/plot/draw/ezplot.m, scripts/plot/draw/ezplot3.m, scripts/plot/draw/ezpolar.m, scripts/plot/draw/ezsurf.m, scripts/plot/draw/ezsurfc.m, scripts/plot/draw/feather.m, scripts/plot/draw/fill.m, scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m, scripts/plot/draw/isocolors.m, scripts/plot/draw/isonormals.m, scripts/plot/draw/isosurface.m, scripts/plot/draw/line.m, scripts/plot/draw/loglog.m, scripts/plot/draw/loglogerr.m, scripts/plot/draw/mesh.m, scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m, scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m, scripts/plot/draw/pcolor.m, scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m, scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m, scripts/plot/draw/plot3.m, scripts/plot/draw/plotmatrix.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m, scripts/plot/draw/private/__add_datasource__.m, scripts/plot/draw/private/__bar__.m, scripts/plot/draw/private/__contour__.m, scripts/plot/draw/private/__errcomm__.m, scripts/plot/draw/private/__errplot__.m, scripts/plot/draw/private/__ezplot__.m, scripts/plot/draw/private/__interp_cube__.m, scripts/plot/draw/private/__line__.m, scripts/plot/draw/private/__marching_cube__.m, scripts/plot/draw/private/__patch__.m, scripts/plot/draw/private/__pie__.m, scripts/plot/draw/private/__plt__.m, scripts/plot/draw/private/__quiver__.m, scripts/plot/draw/private/__scatter__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/quiver.m, scripts/plot/draw/quiver3.m, scripts/plot/draw/rectangle.m, scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m, scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m, scripts/plot/draw/semilogx.m, scripts/plot/draw/semilogxerr.m, scripts/plot/draw/semilogy.m, scripts/plot/draw/semilogyerr.m, scripts/plot/draw/shrinkfaces.m, scripts/plot/draw/slice.m, scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m, scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m, scripts/plot/draw/stem3.m, scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m, scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m, scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m, scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m, scripts/plot/draw/waterfall.m: Moved from plot/ to subdir draw. * scripts/plot/util/__actual_axis_position__.m, scripts/plot/util/__default_plot_options__.m, scripts/plot/util/__gnuplot_drawnow__.m, scripts/plot/util/__next_line_color__.m, scripts/plot/util/__next_line_style__.m, scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/__pltopt__.m, scripts/plot/util/allchild.m, scripts/plot/util/ancestor.m, scripts/plot/util/axes.m, scripts/plot/util/cla.m, scripts/plot/util/clf.m, scripts/plot/util/close.m, scripts/plot/util/closereq.m, scripts/plot/util/colstyle.m, scripts/plot/util/copyobj.m, scripts/plot/util/figure.m, scripts/plot/util/findall.m, scripts/plot/util/findfigs.m, scripts/plot/util/findobj.m, scripts/plot/util/gca.m, scripts/plot/util/gcbf.m, scripts/plot/util/gcbo.m, scripts/plot/util/gcf.m, scripts/plot/util/gco.m, scripts/plot/util/ginput.m, scripts/plot/util/gnuplot_binary.in, scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hdl2struct.m, scripts/plot/util/hggroup.m, scripts/plot/util/hold.m, scripts/plot/util/isaxes.m, scripts/plot/util/isfigure.m, scripts/plot/util/ishghandle.m, scripts/plot/util/ishold.m, scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m, scripts/plot/util/meshgrid.m, scripts/plot/util/ndgrid.m, scripts/plot/util/newplot.m, scripts/plot/util/print.m, scripts/plot/util/printd.m, scripts/plot/util/private/__add_default_menu__.m, scripts/plot/util/private/__fltk_ginput__.m, scripts/plot/util/private/__fltk_print__.m, scripts/plot/util/private/__ghostscript__.m, scripts/plot/util/private/__gnuplot_get_var__.m, scripts/plot/util/private/__gnuplot_ginput__.m, scripts/plot/util/private/__gnuplot_has_feature__.m, scripts/plot/util/private/__gnuplot_has_terminal__.m, scripts/plot/util/private/__gnuplot_open_stream__.m, scripts/plot/util/private/__gnuplot_print__.m, scripts/plot/util/private/__gnuplot_version__.m, scripts/plot/util/private/__go_draw_axes__.m, scripts/plot/util/private/__go_draw_figure__.m, scripts/plot/util/private/__print_parse_opts__.m, scripts/plot/util/private/__tight_eps_bbox__.m, scripts/plot/util/refresh.m, scripts/plot/util/refreshdata.m, scripts/plot/util/saveas.m, scripts/plot/util/shg.m, scripts/plot/util/struct2hdl.m, scripts/plot/util/subplot.m: Moved from plot to subdir util. * etc/HACKING: Updated directory structure info. * scripts/Makefile.am, scripts/plot/appearance/module.mk, scripts/plot/draw/module.mk, scripts/plot/util/module.mk: Added new directories to build system.
author Rik <rik@octave.org>
date Fri, 04 Oct 2013 17:09:08 -0700
parents scripts/plot/struct2hdl.m@0b3cf264ec2f
children d63878346099
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 -*-
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
18 ## @deftypefn {Function File} {@var{h} =} struct2hdl (@var{s})
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
19 ## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p})
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
20 ## @deftypefnx {Function File} {@var{h} =} struct2hdl (@var{s}, @var{p}, @var{hilev})
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16933
diff changeset
21 ## Construct a graphics handle object @var{h} from the structure @var{s}.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16933
diff changeset
22 ##
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17189
diff changeset
23 ## The structure must contain the fields @qcode{"handle"}, @qcode{"type"},
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17189
diff changeset
24 ## @qcode{"children"}, @qcode{"properties"}, and @qcode{"special"}. If the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17189
diff changeset
25 ## handle of an existing figure or axes is specified, @var{p}, the new object
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17189
diff changeset
26 ## will be created as a child of that object. If no parent handle is provided
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17189
diff changeset
27 ## then a new figure and the necessary children will be constructed using the
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17189
diff changeset
28 ## default values from the root figure.
14867
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 ## A third boolean argument @var{hilev} can be passed to specify whether
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16933
diff changeset
31 ## the function should preserve listeners/callbacks, e.g., for legends or
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16933
diff changeset
32 ## hggroups. The default is false.
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16933
diff changeset
33 ## @seealso{hdl2struct, findobj}
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
34 ## @end deftypefn
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
35
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
36 ## Author: pdiribarne <pdiribarne@new-host.home>
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
37 ## Created: 2012-03-04
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
38
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
39 function [h, pout] = struct2hdl (s, p=[], hilev = false)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
40
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
41 fields = {"handle", "type", "children", "properties", "special"};
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
42 partypes = {"root", "figure", "axes", "hggroup"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
43 othertypes = {"line", "patch", "surface", "image", "text"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
44 alltypes = [partypes othertypes];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
45
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
46 if (nargin > 3 || ! isstruct (s))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
47 print_usage ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
48 elseif (! all (isfield (s, fields)))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
49 print_usage ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
50 elseif (isscalar (p))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
51 if (! ishandle (p))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
52 error ("struct2hdl: P is not a handle to a graphic object");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
53 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
54 if (any (strcmp (get (p).type, partypes)))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
55 paridx = find (strcmp (get (p).type, alltypes));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
56 kididx = find (strcmp (s.type, alltypes));
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
57 if (kididx <= paridx)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
58 error ("struct2hdl: incompatible input handles");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
59 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
60 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
61 error ("struct2hdl: %s object can't be parent object", get (p).type);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
62 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
63 hpar = p;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
64 p = [NaN; hpar];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
65 ## create appropriate parent if needed
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
66 if (any (strcmp (s.type, othertypes)))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
67 for ii = (paridx+1) : (numel (partypes)-1)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
68 eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
69 p = [p [NaN; hpar]];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
70 endfor
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
71 elseif (any (strcmp (s.type, {"hggroup", "axes"})))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
72 for ii = (paridx+1) : (kididx-1)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
73 eval (["hpar = " partypes{ii} "(\"parent\", hpar);"]);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
74 p = [p [NaN; hpar]];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
75 endfor
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
76 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
77 par = NaN;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
78 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
79 elseif (isempty (p))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
80 if (any (strcmp (s.type, othertypes)))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
81 par = axes ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
82 elseif (any (strcmp (s.type, {"hggroup", "axes"})))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
83 par = figure ();
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
84 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
85 par = NaN;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
86 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
87 p = [NaN; par];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
88 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
89 ## read parent (last column) in p and remove it if duplicate
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
90 par = p(2,end);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
91 tst = find (p(2,:) == par);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
92 if (numel (tst) > 1)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
93 p = p(1:2, 1:(tst(end)-1));
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
94 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
95
17386
6dbc866379e2 Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents: 17383
diff changeset
96 ## Place the "*mode" properties at the end to avoid having the updaters
15799
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
97 ## change the mode to "manual" when the value is "auto".
15775
a1d1386daeed struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents: 15011
diff changeset
98 names = fieldnames (s.properties);
a1d1386daeed struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents: 15011
diff changeset
99 n = strncmp (cellfun (@fliplr, names, "uniformoutput", false), "edom", 4);
a1d1386daeed struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents: 15011
diff changeset
100 n = (n | strcmp (names, "activepositionproperty"));
a1d1386daeed struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents: 15011
diff changeset
101 names = [names(!n); names(n)];
15799
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
102 if (strcmp (s.type, "axes"))
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
103 n_pos = find (strcmp (names, "position") | strcmp (names, "outerposition"));
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
104 if (strcmp (s.properties.activepositionproperty, "position"))
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
105 names{n_pos(1)} = "outerposition";
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
106 names{n_pos(2)} = "position";
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
107 else
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
108 names{n_pos(1)} = "position";
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
109 names{n_pos(2)} = "outerposition";
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
110 endif
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
111 endif
d0579fed7e22 struct2hdl.m: Set the "position" and "outerposition" properties in the
Ben Abbott <bpabbott@mac.com>
parents: 15775
diff changeset
112 ## Reorder the properties with the mode properties coming last
15775
a1d1386daeed struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents: 15011
diff changeset
113 s.properties = orderfields (s.properties, names);
a1d1386daeed struct2hdl.m: Set the "*.mode" properties last. (Bug # 37645)
Ben Abbott <bpabbott@mac.com>
parents: 15011
diff changeset
114
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
115 ## create object
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
116 if (strcmp (s.type, "root"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
117 h = 0;
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
118 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
119 {"callbackobject", "commandwindowsize", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
120 "screendepth", "screenpixelsperinch", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
121 "screensize"});
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
122 elseif (strcmp (s.type, "figure"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
123 h = figure ();
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
124 elseif (strcmp (s.type, "axes"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
125 ## legends and colorbars are "transformed" in normal axes
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
126 ## if hilev is not requested
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
127 if (! hilev)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
128 if (strcmp (s.properties.tag, "legend"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
129 s.properties.tag = "";
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
130 s.properties.userdata = [];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
131 par = gcf;
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
132 elseif (strcmp (s.properties.tag, "colorbar"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
133 s.properties.tag = "";
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
134 s.properties.userdata = [];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
135 par = gcf;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
136 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
137 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
138
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
139 [h, s] = createaxes (s, p, par);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
140 elseif (strcmp (s.type, "line"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
141 h = createline (s, par);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
142 elseif (strcmp (s.type, "patch"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
143 [h, s] = createpatch (s, par);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
144 elseif (strcmp (s.type, "text"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
145 h = createtext (s, par);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
146 elseif (strcmp (s.type, "image"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
147 h = createimage (s, par);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
148 elseif (strcmp (s.type, "surface"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
149 h = createsurface (s, par);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
150 elseif (strcmp (s.type, "hggroup"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
151 [h, s, p] = createhg (s, p, par, hilev);
15941
8135bce0812a struct2hdl.m: send error when the requested object type is not implemented.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 15799
diff changeset
152 else
8135bce0812a struct2hdl.m: send error when the requested object type is not implemented.
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 15799
diff changeset
153 error ("struct2hdl: %s objects are not implemented yet", s.type)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
154 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
155
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
156 ## children
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
157 p = [p [s.handle; h]]; # [original; new]
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
158 kids = s.children;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
159 nkids = length (kids);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
160 ii = 0;
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
161 while (nkids)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
162 ii++;
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
163 if (! any (ii == s.special))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
164 [h2, p] = struct2hdl (s.children(ii), [p [s.handle; h]], hilev);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
165 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
166 nkids--;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
167 endwhile
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
168
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
169 ## paste properties
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
170 setprops (s, h, p, hilev);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
171
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
172 pout = p;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
173
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
174 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
175
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
176 function [h, sout] = createaxes (s, p, par)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
177 ## regular axes
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
178 if (strcmp (s.properties.tag, ""))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
179 propval = {"position", s.properties.position};
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
180 hid = {"autopos_tag", "looseinset"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
181 for ii = 1:numel (hid)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
182 prop = hid{ii};
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
183 if (isfield (s.properties, prop))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
184 val = s.properties.(prop);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
185 propval = [propval, prop, val];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
186 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
187 endfor
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
188 h = axes (propval{:}, "parent", par);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
189
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
190 if (isfield (s.properties, "__plotyy_axes__"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
191 plty = s.properties.__plotyy_axes__;
17567
0b3cf264ec2f struct2hdl.m: addproperty __plotyy_axes__ of type "data", not "any".
Rik <rik@octave.org>
parents: 17386
diff changeset
192 addproperty ("__plotyy_axes__", h, "data");
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
193 tmp = [p [s.handle; h]];
17383
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
194 tst = ismember (tmp(1:2:end), plty);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
195 if (sum (tst) == numel (plty))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
196 for ii = 1:numel (plty)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
197 plty(ii) = tmp(find (tmp == plty(ii)) + 1);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
198 endfor
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
199 for ii = 1:numel (plty)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
200 set (plty(ii), "__plotyy_axes__", plty);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
201 endfor
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
202 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
203 s.properties = rmfield (s.properties, "__plotyy_axes__");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
204 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
205
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
206 ## delete non-default and already set properties
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
207 fields = fieldnames (s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
208 tst = cellfun (@(x) isprop (h, x), fields);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
209 s.properties = rmfield (s.properties, fields(find (tst == 0)));
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
210
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
211 elseif (strcmp (s.properties.tag, "legend"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
212 ## legends
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
213 oldax = s.properties.userdata.handle;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
214 idx = find (p == oldax);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
215 newax = p(idx+1);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
216 strings = {};
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
217 kids = s.children;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
218 kids(s.special) = [];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
219 oldh = unique (arrayfun (@(x) x.properties.userdata(end), kids));
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
220 for ii = 1:length (oldh)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
221 idx = find (p(1:2:end) == oldh(ii)) * 2;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
222 if (! isempty (idx))
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
223 newh(ii) = p(idx);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
224 if (! strcmp (get (newh(ii), "type"), "hggroup"))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
225 str = get (newh(ii), "displayname");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
226 strings = [strings str];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
227 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
228 str = get (get (newh(ii), "children")(1), "displayname");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
229 strings = [strings str];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
230 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
231 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
232 error ("struct2hdl: didn't find a legend item");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
233 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
234 endfor
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
235 location = s.properties.location;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
236 orientation = s.properties.orientation;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
237 textpos = s.properties.textposition;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
238 box = s.properties.box;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
239
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
240 h = legend (newax, newh, strings, "location", location, ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
241 "orientation", orientation);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
242 set (h, "textposition", textpos); # bug makes "textposition"
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
243 # redefine the legend
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
244 h = legend (newax, newh, strings, "location", location, ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
245 "orientation", orientation);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
246 ## box
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
247 if (strcmp (box, "on"))
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
248 legend ("boxon");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
249 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
250
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
251 ## visibility
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
252 tst = arrayfun (@(x) strcmp (x.properties.visible, "on"), kids);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
253 if (! any (tst))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
254 legend ("hide");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
255 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
256
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
257 ## remove all properties such as "textposition" that redefines
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
258 ## the entire legend. Also remove chidren
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
259 s.properties = rmfield (s.properties, ...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
260 {"userdata", "xlabel",...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
261 "ylabel", "zlabel", "location", ...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
262 "title", "string","orientation", ...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
263 "visible", "textposition"});
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
264
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
265 s.children = [];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
266
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
267 elseif (strcmp (s.properties.tag, "colorbar"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
268 ## colorbar
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
269 oldax = s.properties.axes;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
270 if (! isempty (idx = find (oldax == p)))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
271 ax = p(idx+1);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
272 location = s.properties.location;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
273 h = colorbar ("peer", ax, location);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
274 s.properties = rmfield (s.properties, ...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
275 {"userdata", "xlabel" ...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
276 "ylabel", "zlabel", ...
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
277 "title", "axes"});
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
278 s.children= [];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
279 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
280 error ("hdl2struct: didn't find an object");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
281 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
282 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
283 sout = s;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
284 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
285
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
286 function h = createline (s, par)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
287 h = line ("parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
288 addmissingprops (h, s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
289 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
290
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
291 function [h, sout] = createpatch (s, par)
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
292 prp.faces = s.properties.faces;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
293 prp.vertices = s.properties.vertices;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
294 prp.facevertexcdata = s.properties.facevertexcdata;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
295 h = patch (prp);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
296 set (h, "parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
297 s.properties = rmfield (s.properties,
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
298 {"faces", "vertices", "facevertexcdata"});
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
299 addmissingprops (h, s.properties);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
300 sout = s;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
301 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
302
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
303 function h = createtext (s, par)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
304 h = text ("parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
305 addmissingprops (h, s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
306 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
307
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
308 function h = createimage (s, par)
17189
b1fd3dc31c42 struct2hdl.m: Call image() with a single piece of data to avoid loading default.img.
Rik <rik@octave.org>
parents: 17122
diff changeset
309 h = image (1, "parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
310 addmissingprops (h, s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
311 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
312
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
313 function h = createsurface (s, par)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
314 h = surface ("parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
315 addmissingprops (h, s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
316 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
317
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
318 function [h, sout, pout] = createhg (s, p, par, hilev)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
319 ## Here we infer from properties the type of hggroup we should build
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
320 ## an call corresponding high level functions
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
321 ## We manually set "hold on" to avoid next hggroup be deleted
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
322 ## the proper value of axes "nextplot" will finally be recovered
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
323
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
324 hold on;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
325 if (hilev)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
326 [h, s, p] = createhg_hilev (s, p, par);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
327 if (numel (s.children) != numel (get (h).children))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
328 warning (["struct2hdl: could not infer the hggroup type. ", ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
329 "Will build objects but listener/callback functions ", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
330 "will be lost"]);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
331 if (isfield (h, "bargroup"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
332 delete (get (h).bargroup);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
333 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
334 delete (h);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
335 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
336 h = hggroup ("parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
337 addmissingprops (h, s.properties);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
338 s.special = [];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
339 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
340 oldkids = s.children;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
341 newkids = get (h).children;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
342 nkids = numel (oldkids);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
343 ii = 1;
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
344 while (nkids)
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
345 p = [p [oldkids(ii++).handle; newkids(nkids--)]];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
346 endwhile
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
347 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
348 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
349 h = hggroup ("parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
350 addmissingprops (h, s.properties);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
351 s.special = [];
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
352 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
353 sout = s;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
354 pout = p;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
355 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
356
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
357 function [h, sout, pout] = createhg_hilev (s, p, par)
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
358 fields = s.properties;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
359 if (isfield (fields, "contourmatrix"))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
360 ## contours
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
361 xdata = s.properties.xdata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
362 ydata = s.properties.ydata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
363 zdata = s.properties.zdata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
364 levellist = s.properties.levellist;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
365 textlist = s.properties.textlist;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
366
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
367 ## contour creation
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
368 if (isempty (s.children(1).properties.zdata))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
369 if (strcmpi (s.properties.fill, "on"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
370 [cm2, h] = contourf (xdata, ydata, zdata, levellist);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
371 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
372 [cm2, h] = contour (xdata, ydata, zdata, levellist);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
373 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
374
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
375 ## labels
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
376 if (strcmpi (s.properties.showtext, "on"))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
377 clabel (cm2, h, textlist);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
378 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
379 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
380 [cm2, h] = contour3 (xdata, ydata, zdata, levellist);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
381 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
382
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
383 ## delete already set properties and children
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
384 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
385 {"xdata", "ydata", "zdata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
386 "contourmatrix", "levellist", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
387 "fill", "labelspacing", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
388 "levellistmode", "levelstep", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
389 "levelstepmode", "textlist"...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
390 "textlistmode" , "textstep", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
391 "textstepmode", "zlevel", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
392 "zlevelmode"});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
393
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
394 elseif (isfield (fields, "udata") && isfield (fields, "vdata"))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
395 ## quiver
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
396 xdata = s.properties.xdata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
397 ydata = s.properties.ydata;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
398
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
399 udata = s.properties.udata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
400 vdata = s.properties.vdata;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
401
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
402 h = quiver (xdata, ydata, udata, vdata);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
403
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
404 ## delete already set properties and children
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
405 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
406 {"xdata", "ydata", "zdata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
407 "xdatasource", "ydatasource", "zdatasource", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
408 "udata", "vdata", "wdata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
409 "udatasource", "vdatasource", "wdatasource"});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
410
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
411 elseif (isfield (fields, "format"))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
412 ##errorbar
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
413 form = s.properties.format;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
414 xdata = s.properties.xdata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
415 ydata = s.properties.ydata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
416 xldata = s.properties.xldata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
417 ldata = s.properties.ldata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
418 xudata = s.properties.xudata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
419 udata = s.properties.udata;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
420
16933
e39f00a32dc7 maint: Use parentheses around condition for switch(),while(),if() statements.
Rik <rik@octave.org>
parents: 15941
diff changeset
421 switch (form)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
422 case "xerr"
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
423 h = errorbar (xdata, ydata, xldata, xudata, ">");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
424 case "yerr"
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
425 h = errorbar (xdata, ydata, ldata, udata, "~");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
426 case "xyerr"
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
427 h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "~>");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
428 case "box"
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
429 h = errorbar (xdata, ydata, xldata, xudata, "#");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
430 case "boxy"
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
431 h = errorbar (xdata, ydata, ldata, udata, "#~");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
432 case "boxxy"
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
433 h = errorbar (xdata, ydata, xldata, xudata, ldata, udata, "#~>");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
434 otherwise
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
435 error ("struct2hdl: couldn't guess the errorbar format");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
436 endswitch
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
437 ## delete already set properties
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
438 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
439 {"xdata", "ydata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
440 "xldata", "ldata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
441 "xudata", "udata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
442 "xldatasource", "ldatasource", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
443 "xudatasource", "udatasource", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
444 "format"});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
445
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
446 elseif (isfield (fields, "bargroup"))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
447 ## bar plot
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
448 ## FIXME - here we don't have access to brothers so we first create all
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
449 ## the barseries of the bargroup (but the last), then retrieve information,
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
450 ## and rebuild the whole bargroup.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
451 ## The duplicate are deleted after calling "setprops"
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
452
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
453 bargroup = s.properties.bargroup;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
454 oldh = s.handle;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
455
17383
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
456 temp = ismember ([p(1:2:end) oldh], bargroup);
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
457
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
458 tst = sum (temp) == length (bargroup);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
459
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
460 if (isscalar (bargroup) || !tst)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
461 xdata = s.properties.xdata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
462 ydata = s.properties.ydata;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
463
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
464 h = bar (xdata, ydata);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
465
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
466 ## delete already set properties,
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
467 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
468 {"xdata", "ydata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
469 "xdatasource", "ydatasource", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
470 "bargroup", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
471 "barwidth", "baseline"});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
472 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
473 xdata = [];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
474 ydata = [];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
475
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
476 ##build x/y matrix
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
477 nbar = length (bargroup);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
478 tmp = struct ("handle", NaN, "type", "", "children", [], "special", []);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
479 for ii = 1:(nbar - 1)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
480 idx = find (p(1:2:end) == bargroup(ii)) * 2;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
481 hdl = p (idx);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
482 xdata = [xdata get(hdl).xdata];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
483 ydata = [ydata get(hdl).ydata];
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
484 tmp.children(ii) = hdl2struct (hdl);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
485 endfor
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
486
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
487 xdata = [xdata s.properties.xdata];
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
488 ydata = [ydata s.properties.ydata];
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
489 width = s.properties.barwidth;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
490 h = bar (ydata, width);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
491
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
492 ## replace previous handles in "match", copy props and delete redundant
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
493 for ii = 1:(nbar - 1)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
494 props = tmp.children(ii).properties;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
495 bl = props.baseline;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
496 tmp.children(ii).properties = rmfield (props, {"baseline", "bargroup"});
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
497 setprops (tmp.children(ii), h(ii), p, 1);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
498 delete (tmp.children(ii).handle);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
499 delete (bl);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
500 idxpar = find (p == tmp.children(ii).handle);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
501 p(idxpar) = h(ii);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
502 idxkid = idxpar - 2;
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
503 p(idxkid) = get (h(ii), "children");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
504 endfor
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
505 p(2,((end-nbar+2):end)) = h(1:(end-1));
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
506 h = h(end);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
507
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
508 ## delete already set properties ,
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
509 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
510 {"xdata", "ydata", "bargroup"...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
511 "barwidth", "baseline"});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
512 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
513 elseif (isfield (fields, "baseline"))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
514 ## stem plot
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
515 xdata = s.properties.xdata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
516 ydata = s.properties.ydata;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
517
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
518 h = stem (xdata, ydata);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
519
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
520 ## delete already set properties,
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
521 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
522 {"xdata", "ydata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
523 "xdatasource", "ydatasource", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
524 "baseline"});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
525 elseif (isfield (fields, "basevalue"))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
526 ## area plot
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
527 xdata = s.properties.xdata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
528 ydata = s.properties.ydata;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
529 level = s.properties.basevalue;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
530
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
531 h = area (xdata, ydata, level);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
532
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
533 ## delete already set properties,
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
534 s.properties = rmfield (s.properties, ...
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
535 {"xdata", "ydata", ...
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
536 "xdatasource", "ydatasource"});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
537 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
538 warning ("struct2hdl: could not infer the hggroup type. Will build objects but listener/callback functions will be lost");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
539 h = hggroup ("parent", par);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
540 addmissingprops (h, s.properties);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
541 s.special = []; # children will be treated as normal children
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
542 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
543 sout = s;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
544 pout = p;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
545 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
546
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
547 function setprops (s, h, p, hilev)
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
548 more off;
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
549 if (strcmpi (s.properties.tag, ""))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
550 specs = s.children(s.special);
17383
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
551 if (isempty (specs))
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
552 hdls = [];
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
553 else
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
554 hdls = [specs.handle];
1a4d036e1456 struct2hdl.m: Eliminate some arrayfun instances for perforance.
Rik <rik@octave.org>
parents: 17338
diff changeset
555 endif
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
556 nh = length (hdls);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
557 msg = "";
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
558 if (! nh)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
559 set (h, s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
560 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
561 ## Specials are objects that where automatically constructed with
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
562 ## current object. Among them are "x(yz)labels", "title", high
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
563 ## level hggroup children
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
564 fields = fieldnames (s.properties);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
565 vals = struct2cell (s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
566 idx = find (cellfun (@(x) valcomp(x, hdls) , vals));
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
567 s.properties = rmfield (s.properties, fields(idx));
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
568
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
569 ## set all properties but special handles
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
570 set (h, s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
571
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
572 ## find props with val == (one of special handles)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
573 nf = length (idx);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
574 fields = fields(idx);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
575 vals = vals(idx);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
576 while (nf)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
577 field = fields{nf};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
578 idx = find (hdls == vals{nf});
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
579 spec = specs(idx);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
580 if (isprop (h, field))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
581 h2 = get (h , field);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
582 set (h2, spec.properties);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
583 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
584 nf--;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
585 endwhile
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
586
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
587 ## If hggroup children were created by high level functions,
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
588 ## copy only usefull properties.
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
589 if (hilev)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
590 if (strcmp (s.type, "hggroup"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
591 nold = numel (s.children);
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
592 nnew = numel (get (h).children);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
593
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
594 if (nold == nnew)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
595 hnew = get (h).children;
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
596 ii = 1;
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
597 while (ii <= nnew)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
598 try
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
599 set (hnew (ii), "displayname", ...
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
600 s.children(ii).properties.displayname);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
601 catch
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
602 sprintf ("struct2hdl: couldn't set hggroup children #%d props.", ii);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
603 end_try_catch
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
604 ii ++;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
605 endwhile
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
606
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
607 else
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
608 error ("struct2hdl: non-conformant number of children in hgggroup");
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
609 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
610 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
611 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
612 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
613
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
614 elseif (strcmpi (s.properties.tag, "legend")
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
615 || strcmpi (s.properties.tag, "colorbar"))
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
616 set (h, s.properties);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
617 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
618
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
619 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
620
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
621 function out = valcomp (x, hdls)
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
622 if (isfloat (x) && isscalar (x))
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
623 out = any (x == hdls);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
624 else
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
625 out = 0;
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
626 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
627 endfunction
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
628
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
629 function addmissingprops (h, props)
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
630 hid = {"autopos_tag", "looseinset"};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
631 oldfields = fieldnames (props);
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
632 curfields = fieldnames (get (h));
17386
6dbc866379e2 Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents: 17383
diff changeset
633 missing = ! ismember (oldfields, curfields);
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
634 idx = find (missing);
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
635 for ii = 1:length (idx)
14867
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
636 prop = oldfields{idx(ii)};
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
637 if (! any (strcmp (prop, hid)))
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
638 addproperty (prop, h, "any");
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
639 endif
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
640 endfor
97ce18b62d0f New Functions; copyobj.m, hdl2struct.m, struct2hdl.m
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
diff changeset
641 endfunction
15011
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
642
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
643
f34bea431e4f maint: Use Octave coding standards for copyobj.m, hdl2struct.m, struct2hdl.m.
Rik <rik@octave.org>
parents: 15007
diff changeset
644 ## FIXME: Need validation tests
17338
1c89599167a6 maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents: 17281
diff changeset
645