Home > atmlab > graphs > clonefig.m

clonefig

PURPOSE ^

this program copies a figure to another figure

SYNOPSIS ^

function clonefig(inFigNum,OutFigNum)

DESCRIPTION ^

 this program copies a figure to another figure
 example: clonefig(1,4) would copy Fig. 1 to Fig. 4
 Matt Fetterman, 2009
 pretty much taken from Matlab Technical solutions:
 http://www.mathworks.com/support/solutions/en/data/1-1UTBOL/?solution=1-1UTBOL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

DOWNLOAD ^

clonefig.m

SOURCE CODE ^

0001 function clonefig(inFigNum,OutFigNum)
0002 % this program copies a figure to another figure
0003 % example: clonefig(1,4) would copy Fig. 1 to Fig. 4
0004 % Matt Fetterman, 2009
0005 % pretty much taken from Matlab Technical solutions:
0006 % http://www.mathworks.com/support/solutions/en/data/1-1UTBOL/?solution=1-1UTBOL
0007 hf1=figure(inFigNum);
0008 hf2=figure(OutFigNum);
0009 clf;
0010 compCopy(hf1,hf2);
0011 
0012 function compCopy(op, np)
0013   %COMPCOPY copies a figure object represented by "op" and its % descendants to
0014   %another figure "np" preserving the same hierarchy.
0015   
0016   ch = get(op, 'children');
0017 
0018   if ~isempty(ch)
0019     nh = copyobj(ch,np);
0020     for k = 1:length(ch)
0021       compCopy(ch(k),nh(k));
0022     end
0023   end
0024 return

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005