Reading data from multiple files in ascending order.
Afficher commentaires plus anciens
I have many folders and in each I have potentially 480 txt files (“potentially” because in some folders some files are missing) which names changing in ascending order from:
aaaa001a00.txt
aaaa001a30.txt
aaaa001b00.txt
aaaa001b30.txt
…
aaaa001x00.txt
aaaa001x30.txt
aaaa002a00.txt
…
aaaa010x30.txt
(bold number change from 1 to 10, bold italic letter changes from “a” to “x” (24 letters) and number after this letter is 00 or 30).
In each file there are four columns with data, as below:
0.5031 0.5709 0.1937 0.7852
0.5074 0.5719 0.1878 0.7873
0.5127 0.5727 0.1823 0.7900
…
0.5170 0.5729 0.1787 0.7921
0.5211 0.5733 0.1730 0.7938
But the number of line can be different in each file…
In each folder I would like to read all 480 “potentially” files in ascending order (as listed).
If file exist I would like to read data from the last line… (for example: 0.5211 0.5733 0.1730 0.7938)
If file don’t exist I would like “to read”: NaN NaN NaN NaN.
How it could be done in matlab?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Workspace Variables and MAT Files dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!