In MATLAB R2011b, I have a script which explicitly specifies a figure number (say, Figure 1) and plots on it. I wish to keep this plot open and run the script again with different parameters, so that I can visually compare the new and previous plots.
How can I rename the previous figure (to, say, Figure 2) so that the new plot does not overwrite it, and thus allowing both plots to be visible, without
- Modifying the script, or
- Saving the previous figure as a .fig file and reopening it as another figure
from both
- The command line, and
- using the figure’s GUI?
You can use
getobjto copy the contents of one figure to another:Other properties can be copied using the
setandgetcommands: