开发者

MATLAB clear current figure

开发者 https://www.devze.com 2023-01-01 18:29 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号