Reading files in a specified order
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
L'O.G.
am 29 Mär. 2022
Bearbeitet: Stephen23
am 29 Mär. 2022
I have multiple files of the same type in a directory that all have the same beginning, say "A11_K", followed by a numbers specific to the file. For example
A11_K25-1.txt
A11_K25-2.txt
A11_K27-1.txt
I know I can read all of the files of that type using something like files = dir('A11_K*') but how do I make sure I read them, in the numeric order following the K above as in the example list?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Fangjun Jiang
am 29 Mär. 2022
>> sort({'A11_K25-2.txt','A11_K27-1.txt','A11_K25-1.txt'})
ans =
1×3 cell array
{'A11_K25-1.txt'} {'A11_K25-2.txt'} {'A11_K27-1.txt'}
0 Kommentare
Siehe auch
Kategorien
Mehr zu Downloads 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!