从文本文件中读取数据画图

时间:2021-10-19 23:46:10

数据格式:

1 0.0416667 0.778667 0.778667
2 0.0833333 0.767444 0.773055
3 0.0882353 0.745033 0.763715
4 0.0909091 0.732737 0.75597
5 0.106383 0.905655 0.785907
6 0.12766 0.720142 0.774946
7 0.0864198 0.730465 0.768592
8 0.0792079 0.711815 0.761495
9 0.0849057 0.703917 0.755097
10 0.0943396 0.649519 0.744539

matlab程序:

[id, kn, score, wScore]=textread('D:\matlab\log1.txt', '%d%f%f%f');
%plot(wScore);
%hold on
%plot(score);
%plot(kn);
plot(id,kn,id,wScore,id,score);
%plot(id,kn,id,wScore);