Using Textscan and Concatenation of multiple .txt files
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Fangjun Jiang
el 20 de Jun. de 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
0 comentarios
Walter Roberson
el 20 de Jun. de 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.
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!