Read text file data
Mostra commenti meno recenti
Hi. I would like to read my numerous text file which is named like 001_EQ.txt, 002_EQ.txt,......,099_EQ.txt,100_EQ.txt.
filename1 = strcat(int2str(1),'_EQ.txt');
This is a code that i tried but didn't worked well.
Thanks for your help.
Best regard.
1 Commento
Rik
il 29 Apr 2022
You should also not use numbered variables. Use arrays instead.
Risposte (1)
Voss
il 29 Apr 2022
You can generate the file names in sequence like this:
for ii = 1:100
filename = sprintf('%03d_EQ.txt',ii);
% then read file filename
end
Or generate file names all at once like this:
filenames = sprintfc('%03d_EQ.txt',1:100);
for ii = 1:100
% read file filenames{ii}
end
Categorie
Scopri di più su Standard File Formats in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!