matlab调用txt文件数据并做修改后保存到TXT中
2个回答
展开全部
fin=fopen('aa.txt','r');
fout=fopen('bb.txt','w');
while ~feof(fin)
tline = fgets(fin);
if( ~ischar(tline) )
break;
end
yy=str2num(tline(1:4));
mm=str2num(tline(5:6));
dd=str2num(tline(7:8));
h=str2num(tline(9:10));
m=str2num(tline(11:12));
fprintf(fout,'%d %0.2d %0.2d %0.2d %0.2d %0.2d\r\n',yy,mm,dd,h,m,0);
end
fclose(fin);
fclose(fout);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询