MATLAB: Figure(2) not opening a new window, simply overwrites figure(1)

figurenot a bugpossible bug

Hi all,
I have this problem which infuriates me.
Whenever I try to use 'figure(2) = plot(…);' after 'figure(1) = plot(…);', the second plot simply appears on figure(1). No new window name Figure 2 appears. Sometimes it completely deletes figure 1. Please say you've heard of this.

Best Answer

"'figure(2) = plot(...);" is not the correct calling. Try this:
figure(2);
plot(...);
This opens a new figure at first and inserts a plot afterwards.
Your command stores the line handle replied by the plot command in the 2nd element of the variable called "figure". This has the side effect, that the command figure is "shadowed" by the variable, such that it cannot be called directly anymore.
Related Question