how to read different file name using for loops

9 visualizaciones (últimos 30 días)
shanka sharma
shanka sharma el 3 de Oct. de 2018
Comentada: Stephen23 el 3 de Oct. de 2018
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;

Respuesta aceptada

KSSV
KSSV el 3 de Oct. de 2018
files = dir('*.HDF5') ;
N = length(files) ;
for i = 1:N
thisfile = files(i).name ;
% do what you want ;
end
  1 comentario
Stephen23
Stephen23 el 3 de Oct. de 2018
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by