Home > chronux_2_00 > spikesort > utility > matlabtools > copyfig.m

copyfig

PURPOSE ^

COPYFIG Duplicate all children of a figure.

SYNOPSIS ^

function target = copyfig(source)

DESCRIPTION ^

COPYFIG           Duplicate all children of a figure.
   COPYFIG(FIG) makes a copy of the figure specified by the handle FIG in
   a new figure.  The copied figure includes all children of FIG.

   FIG2 = COPYAXES(FIG) returns a handle to the copied FIGURE.

   See also COPYOBJ, COPYAXES.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function target = copyfig(source)
0002 %COPYFIG           Duplicate all children of a figure.
0003 %   COPYFIG(FIG) makes a copy of the figure specified by the handle FIG in
0004 %   a new figure.  The copied figure includes all children of FIG.
0005 %
0006 %   FIG2 = COPYAXES(FIG) returns a handle to the copied FIGURE.
0007 %
0008 %   See also COPYOBJ, COPYAXES.
0009 
0010 %%%%%%%%%%%%%%%%%%%%%%%%%%%% Check Input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0011 if (~ishandle(source) || ~strcmp(get(source,'Type'), 'figure'))
0012     error('Input must be the handle to an existing figure.');
0013 end
0014 children = get(source, 'Children')';
0015 possource = get(source, 'Position');
0016 clrmap = get(source, 'Colormap');
0017 renderer = get(source, 'Renderer');
0018 
0019 %%%%%%%%%%%%%%%%%%%%%%%%% Create Target Figure %%%%%%%%%%%%%%%%%%%%%%%%%
0020 target = figure;
0021 set(target, 'Position', [50 50 possource(3:4)]);  % copy orig size but not location
0022 set(target, 'Colormap', clrmap, 'Renderer', renderer);
0023 
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%% Make the Copy %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 copyobj(children, target);
0026 if (nargout == 0),  clear target;  end;

Generated on Fri 15-Aug-2008 11:35:42 by m2html © 2003