Using Textscan and Concatenation of multiple .txt files
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have files named T0.txt, T3.txt, T6.txt, ..., T600.txt, each is single column vector with 270 real numbers. I want to read these in one go, and concatenate into one single column array.
I can do this one at a time but it takes a very long time!
Does anyone know a way to use TEXTSCAN to open multiple .txt files and concatenate in one pass?
Any help would be appreciated!
robin
0 件のコメント
回答 (2 件)
Fangjun Jiang
2011 年 6 月 20 日
With 200 files (or 600 file) and each file contains 270x1 data, I wouldn't think it would take long if you write a program to read it one at a time and then concatenate them.
With that said, if you really want to do what you want, one possible way to do it is to combine all the text files together first.
This old DOS command can combine multiple files together.
copy t0.txt+t3.txt+T6.txt MyBigFatTextFile.txt
0 件のコメント
Walter Roberson
2011 年 6 月 20 日
textscan() does not open files at all: it operates on already-open file identifiers.
I cannot think at the moment of any MATLAB data-import function that handles sequences of files automatically. If there is one, it must be fairly special purpose, such as DICOM or financial series.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!