How can I plot a previous plot into a new figure?

6 views (last 30 days)
I have a for loop that is plotting Temperature against Fuel-Mass Percent. The temperature values are being read from text files. Each time a text file is read the previous temperature matrix is erased. I plotted the first set of Temperature values in figure 1 and the second set of Temperature values in figure 2, but now I need to plot the second set of Temperature plot with Temperature sets 3,4, and 5. How can I store the second figure and add it to my third figure which contains plots 3,4, and 5? Thank you for the help!

Answers (1)

Walter Roberson
Walter Roberson on 20 Nov 2013
Well...
figure2 = 2; %you said "figure 2" so I assume its numeric handle is 2.
figure3 = 3; %you said "figure 3" so I assume its numeric handle is 3.
ax2 = findobj(figure2, 'type', 'axes');
ax3 = findobj(figure3, 'type', 'axes');
copyobj(get(ax2, 'Children'), ax3);
But really, easier is to just keep a copy of the data and plot() it along with the other data.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!