Data indexing
显示 更早的评论
I have a text files which contain only one data. What I want to do is to save all datas in one text file, for example the file is in folder named J and in this folder there are files like a_1.txt,a_2.txt ...a_i.txt where i can be any posetive integer. These text files contains only one data and it is a number. The idea I want is to save all these files in one file and arrange the numbers accordingly. Any idea would be appreciated. Regards
回答(1 个)
Fangjun Jiang
2011-10-11
I guess I found another use of an old trick. Check the value of the string "Cmd" after running the following three lines of code.
NumberOfFile=20;
Str=sprintf('a_%d.txt+',1:NumberOfFile-1);
Cmd=['copy ',Str,'a_',num2str(NumberOfFile),'.txt Output.txt'];
And then run:
System(Cmd);
The combined text file will be in Output.txt
类别
在 帮助中心 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!