1 %COPYFIG Create a copy of a figure, without changing the figure
4 % fh_new = copyfig(fh_old)
6 % This
function will create a copy of a figure, but not change the figure,
7 % as copyobj sometimes does, e.g. by changing legends.
10 % fh_old - The handle of the figure to be copied. Default: gcf.
13 % fh_new - The handle of the created figure.
15 % Copyright (C) Oliver Woodford 2012
17 function fh = copyfig(fh)
23 if isempty(findall(fh, 'Type', 'axes', 'Tag', 'legend'))
24 % Safe to copy using copyobj
27 % copyobj will change the figure, so save and then load it instead
28 tmp_nam = [tempname '.fig'];