# MATLAB: Is there a clever way to extract piece of x axis of the plot from a script and put it to another plot in another script

axisplottingscript

Hi I want to compare two solution's plots. Each are calcuated separate scripts.
Can I extract a piece of x axis of one solution and locate to another plot in another script?
I have
• p1 plot whose x_axis( from 0 to 1) in script A
• p2 plot x_axis( from 0 to 1) in the script B
Can I extract the p1 whose x_axis (from 0 to 0.1) and put it to the same plot as p2 in script B? Is there any shortcut? Thanks

x1 = [0 1];y1 = [0 1];x2 = [0 2];y2 = [0 5];hfig(1)=figure(1);plot(x1,y1);hfig(2)=figure(2);plot(x2,y2);ax1 = get(hfig(1),'children');ax2 = get(hfig(2),'children');ax1plot = get(ax1(1),'children');copyobj(ax1plot,ax2(1))