Using Textscan and Concatenation of multiple .txt files
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Fangjun Jiang
il 20 Giu 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 Commenti
Walter Roberson
il 20 Giu 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 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!