【发布时间】:2015-12-19 01:56:06
【问题描述】:
我想合并 'n' 个文本文件。
% Content of files ('its is just dummy code')
file1.txt
19.09.2015 1 2 3 4
file2.txt
20.09.20155 2 3 7
file3.txt
21.09.2015 6 9 3 8
file4.txt %empty file
[FileNames,PathName] = uigetfile('*.txt','Select the txt file', 'MultiSelect', 'on');
Ofilestr='combinefile.txt'; % open an empty file to merge all
fileID = fopen(Ofilestr,'w');
fclose(fileID);
nbfiles =length(FileNames);
for it=1:nbfiles
file=FileNames{1,it};
% system('copy file+Ofilestr Ofilestr') %% %% not working
system(['copy' file+Ofilestr 'Ofilestr']) %% %% not working
end
任何想法。也是这个问题的另一种解决方案。
【问题讨论】:
标签: matlab