0

我需要以 .txt 格式打开数据文件并从中生成图表。我想将所有图叠加在一起,以便我可以在它们之间进行比较。我正在做以下事情。我有 5 个名为 0.txt,1.txt,2.txt....5.txt 的数据文件

for s=0:5

str = strcat(int2str(s),'m.txt');
fid = fopen(str);

A =  textscan(fid, '%f %f %f %f %f %*f %*f %*f %*f %*f %*s %*s %*s') ;
%%%%read the file
a = A{1};
e = A{2};
c = A{3};
x = A{4};
y = A{5};

figure;
plot (x(1:end-1),g);
hold on

end

但我无法叠加情节!

4

1 回答 1

4

我会推荐以下内容:

figure; hold on;

for s=0:5
   % contents of your for loop goes here
   % reading in the text file
   % plot(...)
end  

hold off;
于 2013-05-24T04:54:30.693 回答