fp = fopen('temp.txt','r');
ID = 0;
flgRead = 0;
X = [];
Y = [];
tX = [];
tY = [];
while 1
tline = fgetl(fp);
if ~ischar(tline), break, end
if length(tline) == 1
ID = ID + 1;%发现一条曲线数据,就加1
flgRead = 1;
X = [X tX];
Y = [Y tY];
tX = [];
tY = [];
end
if length(tline) > 1 && flgRead == 1
aa = sscanf(tline,'%f %f');
tX = [tX; aa(1)];
tY = [tY; aa(2)];
end
end
X = [X tX];
Y = [Y tY];
figure,plot(X(:,1),Y(:,1),'r',X(:,2),Y(:,2),'g',X(:,3),Y(:,3),'b')