fidin=fopen('C:UsersyteDesktop新建文件夹 (4) r4.txt','r');
fidout=fopen('C:UsersyteDesktop新建文件夹 (4) r4_1.txt','w');
nline=0;
% newPrefix = '/home/hzj';
while ~feof(fidin) % 判断是否为文件末尾
tline=fgetl(fidin); % 从文件读行
new_tline = tline(1:8);
% nn_tline = strcat(newPrefix,new_tline);
fprintf(fidout,'%s
',new_tline);
nline=nline+1;
end
fclose(fidin);
fclose(fidout);
create_txt.bat
DIR *.* /B> LIST.TXT
% 创建并写入txt
fid = fopen('ff.txt','wt');
fprintf(fid,'%d %d %d %d %d %d %d %d %d %d
',a)