Data indexing
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Fangjun Jiang
on 11 Oct 2011
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
0 Comments
See Also
Categories
Find more on Data Import and Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!