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!