# HG changeset patch # User pantxo # Date 1353338105 -3600 # Node ID cd3d7f1261900f6ddd8b763d2f95211f8074c4f8 # Parent 9fee0b741de670fb0b8080e4246205f51851bdcd copyobj.m: ensure gca() and gcf() are reset to original values diff -r 9fee0b741de6 -r cd3d7f126190 scripts/plot/copyobj.m --- a/scripts/plot/copyobj.m Sat Dec 01 18:10:55 2012 +0100 +++ b/scripts/plot/copyobj.m Mon Nov 19 16:15:05 2012 +0100 @@ -41,6 +41,10 @@ print_usage (); endif + ## current figure and axes + cf = gcf (); + ca = gca (); + ## compatibility of input handles kididx = find (strcmp (alltypes, get (horig).type)); paridx = find (strcmp (alltypes, get (hparent).type)); @@ -56,6 +60,12 @@ hnew = struct2hdl (str, hparent); endif + ## reset current figure (and eventually axes) to original + set (0, "currentfigure", cf); + if (get (hnew, "parent") == cf) + set (cf, "currentaxes", ca) + endif + endfunction