Integrating several text files

2 ビュー (過去 30 日間)
Morteza Tohidi
Morteza Tohidi 2020 年 12 月 2 日
コメント済み: Walter Roberson 2020 年 12 月 3 日
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.

回答 (1 件)

David Hill
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
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?
Walter Roberson
Walter Roberson 2020 年 12 月 3 日

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by