Using Textscan and Concatenation of multiple .txt files

1 Ansicht (letzte 30 Tage)
robin mooney
robin mooney am 20 Jun. 2011
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

Antworten (2)

Fangjun Jiang
Fangjun Jiang am 20 Jun. 2011
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

Walter Roberson
Walter Roberson am 20 Jun. 2011
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.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by