MATLAB clear current figure
I want to clear MATLAB's global CurrentFigure
property, because I need a plot that I make to not be overwritten if a careless user uses plot
without opening a new fi开发者_如何转开发gure. I tried
set(0, 'CurrentFigure', []);
But it doesn't seem to work. Is this impossible?
No, this doesn't work.
What does work is set(myFigureHandle,'HandleVisibility','off')
. This way, the figure with the handle myFigureHandle
will not become the current figure anymore.
To be really safe, you may want to set the axes' handle visibility to 'off'
, which will hide them from gca
. In order to plot into these axes, you'll have to use plot(myAxesHandle,...)
, though, i.e. you have to explicitly point to the axes if you want to plot there.
精彩评论