Matlab按行处理数据
这篇博客实现利用matlab读入一个 .txt 文本文件,并且处理文件内的数据,并生成一个新的文件
%新建一个文件,用来存储整理过后的数据
filename = 'F:\z1.txt';
fid=fopen(filename,'w'); % ‘w’,以“写”的方式打开(write)
%打开目标文件(待处理的文件)
filepath = 'F:\z2.txt';
f = fopen(filepath,'r'); ‘r’,以“读”的方式打开(read)
%循环读取文件的每一行
while feof(f) ~