matlab怎样从data.txt文件中读数据然后画一张二维图片?本人刚刚接触matlab,跪求代码

2026年09月10日 02:29
有1个网友回答
网友(1):

Fid = fopen('D:/data.txt');
x = 1;
while(~feof(Fid))
s = fgetl(Fid);
num = str2num(s)
for i=1:length(num)
plot(x,num(i),'.');
hold on;
end
x = x+1;
hold on
end
fclose(Fid);