|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
实验数据太多(40961行,m列, ),想每20行取一行数据,下面以一列为例:
test1.txt
1
2
。
。
。
40961
输入命令:
function Column1
N=40961;
fin=fopen('test1.txt','r');
fout=fopen('out.txt','w');
x=zeros(N,1);
x=fscanf(fin,'%d');
for i=1:N/20;
fprintf(fout,'%15.9f\n',x(1+(i-1)*20));
end
fclose(fin);
fclose(fout);
显示出错信息:
??? Index exceeds matrix dimensions.
Error in ==> D:\MATLAB6p5\work\Column1.m
On line 9 ==> fprintf(fout,'%15.9f\n',x(1+(i-1)*20));
请教各位高手有什么好的办法解决啊? |
|