MATLAB Answers


Set default to plot in a new figure

Erin 님이 질문을 제출함. 9 Sep 2014
최근 활동 jkr 님이 댓글을 추가함. 8 May 2018
Is it possible to set the MATLAB default to automatically open plots in a new figure instead of reusing the current figure?

  댓글 수: 1

Is it an option to programmatically generate a new figure?

로그인 to comment.

답변 수: 2

Star Strider 님의 답변 9 Sep 2014
Star Strider 님이 편집함. 9 Sep 2014

It won’t automatically do that (it can’t guess what you’re thinking, unfortunately), but you can program it to do so.
Use the figure function:
x = linspace(0,2*pi,250);
for k1 = 1:3
y = sin(k1*x);
plot(x, y)
axis tight
You can also use a variation on this theme to produce subplot axes in a figure.

  댓글 수: 0

로그인 to comment.

Erin 님의 답변 9 Sep 2014

I was just wondering if there was a way to change the startup file to do it automatically when MATLAB starts.

  댓글 수: 2

I looked through ‘Options’ and the available online documentation and couldn’t find anything on changing that default. The closest you can likely get is the newplot function. I doubt if it would work as a default anyway, since it reads the current figure’s 'NextPlot' property and acts accordingly.
Can this become an enhancement request please? Reuse figure as a default does all kinds of stupid things, like plotting a histogram on the axes of a prior scatterplot. These can be readily corrected, but involve unnecessary rework. The ability to create plots quickly and easily in the variable browser is a powerful convenience. Why not make it work a bit better. It seems it should be simple.

로그인 to comment.

Translated by