how to read different file name using for loops
11 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
KSSV
2018 年 10 月 3 日
files = dir('*.HDF5') ;
N = length(files) ;
for i = 1:N
thisfile = files(i).name ;
% do what you want ;
end
1 件のコメント
Stephen23
2018 年 10 月 3 日
@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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!