Integrating several text files
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello
I have several text files which each of them contains thousands of numbers in 2 columns. I want to integrate them all into one file with the same formate, starting from the first row of the first file and ending with the last row of the last file.
댓글 수: 0
답변 (1개)
David Hill
2020년 12월 3일
Just read them in and concatenate.
b=[];
for n=1:numberoffiles
fileName=sprintf('yourfile%d',n);%assuming file names are numbered
a=readmatrix(fileName);
b=[b;a];%concatenate
end
댓글 수: 5
Rik
2020년 12월 3일
If you have a way to order them, you can read them in that order. Are you storing the file names in a struct or a cell?
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!