## Copyright (C) 2010 Soren Hauberg ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 3 of the License, or (at ## your option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; see the file COPYING. If not, see ## . ## -*- texinfo -*- ## @deftypefn address@hidden =} handle2struct (@var{h}) ## @end deftypefn function s = handle2struct (h) ## Check input if (nargin != 1) error ("handle2struct: wrong number of input arguments"); endif if (!ishandle (h)) error ("handle2struct: input argument must be a graphics handle"); endif ## Do the actual work s.type = get (h, "type"); s.handle = h; s.properties = get (h); # XXX: it seems Matlab doesn't store all of the figure's properties children = get (h, 'children'); for k = 1:length (children) child = children (k); s.children (k) = handle2struct (child); endfor ## XXX: I don't know what Matlab puts in this field s.special = []; endfunction