how to read different file name using for loops
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have GPM half hourly precipitation data sets with different file names, my script example and a file name is attached below, every folder has single day half hourly data sets,
Number of files per folder=48; attachments filelist=example of a file name; extraction= current program file;
I need to convert all half-hourly file into daily;
0 commentaires
Réponse acceptée
KSSV
le 3 Oct 2018
files = dir('*.HDF5') ;
N = length(files) ;
for i = 1:N
thisfile = files(i).name ;
% do what you want ;
end
1 commentaire
Stephen23
le 3 Oct 2018
@KSSV i am trying to read file by year,month,day-startime-endtime.minute using loop such as
clc,clear all
%file name=3B-HHR.MS.MRG.3IMERG.20140412-S000000-E002959.0000.V05B.HDF5
days=[31 28 31 30 31 30 31 31 30 31 30 31];
year=2013;
for i=1:3
year=year+1;
month=1;
for j=1:12
month=1+(j-1)
day=1;
for jj=1:days(j);
hour=1;
for k=1:24
if rem(k,2)==0
hour=0+(k-1)*10000;
else
hour=3000+(k-1)*10000;
end
minute=30*(k-1);
minute=minute+30
sec=hour+2959;
if month<10
filein=['C:\NEW_DATA_SETS\imerg\3B-HHR.MS.MRG.3IMERG.' num2str(year) ...
'' num2str(month) '' num2str(jj) '-S' num2str(hour) '-E' num2str(sec) ...
'.' num2str(minute) '.V05B.HDF5'];
else
filein=['C:\NEW_DATA_SETS\imerg\3B-HHR.MS.MRG.3IMERG.' num2str(year) ...
'' num2str(j) '' num2str(jj) '-S' num2str(hour) '-E' num2str(sec) ...
'.' num2str(minute) '.V05B.HDF5'];
end
end
end
end
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Type Conversion 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!