MATLAB: Plot at the same figure

figureplot

Hi,
I have two m scripts with the same code for plotting. How can I plot results from the two scripts at the same plot?
figure1 = figure('Color',[0 1 1]);
axes1 = axes('Parent',figure1,'FontSize',12,'FontName','arial');
plot1 = plot(X,Y,'Parent',axes1,'MarkerSize',3);
hold all;
set(plot1(1),'MarkerFaceColor',[1 0 1],'Color',[1 0 1]);
Thank you

Best Answer

The problem are these lines:
figure1 = figure('Color',[0 1 1]);
axes1 = axes('Parent',figure1,'FontSize',12,'FontName','arial');
which creates a new figure. Simply remove it in the last 2 m-files and it should work.