# 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 --git a/scripts/plot/copyobj.m b/scripts/plot/copyobj.m --- a/scripts/plot/copyobj.m +++ b/scripts/plot/copyobj.m @@ -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