Effacer les filtres
Effacer les filtres

read files in yyyymmddhhmm format

2 vues (au cours des 30 derniers jours)
wave_buoys
wave_buoys le 23 Août 2017
Modifié(e) : Stephen23 le 23 Août 2017
Hi,
I have a bunch of files named in yyyymmddhhmm format. For example: 201111010000.txt 201111010300.txt 201111011000.txt 201111011300.txt ... and so on. I want to loop through each file to get the data. Could someone help?
Thanks
  1 commentaire
Stephen23
Stephen23 le 23 Août 2017
Modifié(e) : Stephen23 le 23 Août 2017
Luckily you used the best date format in the world: one of the main benefits of using ISO 8601 is that the dates automatically sort into chronological order. This makes code much simpler and more efficient.

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 23 Août 2017
files = dir('*.txt') ; % you are in the folder of text files
N = length(files) ; % total number of files
for i = 1:N % loop for each file
thisfile = files(i).name ;
%%load the data
% Store if you want or calculate
end
  1 commentaire
wave_buoys
wave_buoys le 23 Août 2017
thank you. That works

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by