Setting the property NextPlot
of the current figure to new
will create a new plot on the next call to plot()
. Here's a small example:
plot(1:10, 1:10); % create a figure
set(gcf, 'NextPlot', 'new'); % next plot goes in new figure
plot(1:10, 1:10);
The CurrentFigure
property you tried to change just stores the handle to the figure that has been used/focused most recently. Its value must be a valid figure handle. You could of course just create a new empty figure with figure()
which automatically sets CurrentFigure
to the handle of the newly created figure. But then you have two figure windows open. Therefore I think the above method is a little more elegant.