MATLAB 抽取子图的直线数据

部分参考了这个网址,这个网址还不错

http://www.chinavib.com/thread-101930-1-1.html

直接上代码吧

clc;
clear all
x1=1:2;
x2 =2:3;
x3=3:4;
x4=4:5;
y1=x1.^2;
y2=x2.^2;
y3 =x3.^2;
y4=x4.^2;
subplot(4,1,1)
plot(x1,y1)
subplot(4,1,2)
plot(x2,y2)
subplot(4,1,3);
plot(x3,y3);
subplot(4,1,4);
plot(x4,y4);


figure_info=findall(gcf,'type','line');
xx=get(figure_info,'xdata');
yy=get(figure_info,'ydata');


xc1 = xx{4+1-1}
xc2 = xx{4+1-2}
xc3 = xx{4+1-3}
xc4 = xx{4+1-4}
% There exists a simple relation 
yc1 = yy{4+1-1}
yc2 = yy{4+1-2}
yc3 = yy{4+1-3}
yc4 = yy{4+1-4}

你可能感兴趣的:(MATLAB 抽取子图的直线数据)