plot - Matlab - "seal" a figure so that plotting won't overwrite it, but will create a new figure automatically -
i'm writing script draws figure. i'd figure stay intact until closed user manually (e.g. clicking cross).
if user issues plotting command in matlab prompt, should not affect existing figure, should open new figure automatically.
how block default behaviour matlab reuses figure objects?
this may important when using figure interactive user interface, should not replaced other content when user wishes plot something.
what i've tried: help gcf
says retrieves global 'currentfigure'
property. so, after plotting, tried set('currentfigure', 12345)
, hoping reset current figure nonexisting value (also tried zero, empty array). complains needs handle. tried instantiate handle: set('currentfigure', handle())
, complains it's abstract class. guess i'm looking lightweight handle subclass can instantiated.
setting property nextplot
of current figure new
create new plot on next call plot()
. here's small example:
plot(1:10, 1:10); % create figure set(gcf, 'nextplot', 'new'); % next plot goes in new figure plot(1:10, 1:10);
the currentfigure
property tried change stores handle figure has been used/focused recently. value must valid figure handle. of course create new empty figure figure()
automatically sets currentfigure
handle of newly created figure. have 2 figure windows open. therefore think above method little more elegant.
Comments
Post a Comment