how to read different file name using for loops

11 ビュー (過去 30 日間)
shanka sharma
shanka sharma 2018 年 10 月 3 日
コメント済み: Stephen23 2018 年 10 月 3 日
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;

採用された回答

KSSV
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
Stephen23 2018 年 10 月 3 日
shanka sharma'a "Answer" moved here and formatted properly:
@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 ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by