I use the code below to generate filenames every five minutes based on the number of timesteps. But it's not working correctly. If you open precipFileNames, you will see that midway, the code stops doing it every 5 minutes and instead does 5 minutes 1 second which generates a filename like this:
E:\MRMS\2004\PRECIPRATE.20040402.051959.tif
How can I do this correctly?
timeSteps = 417;
pathstr = 'E:\MRMS\2004';
startTime = 7.320395312500000e+05;
peakTime2 = 7.320400104166666e+05;
precipFileNames=cell(timeSteps,1);
for l = 1:timeSteps
%precipFileNames{m} = strcat(fileparts(refFile), filesep, datestr(startTime, 'yyyy'), filesep,'PRECIPRATE.',datestr(startTime, 'yyyymmdd.hhMMss'), '.tif');
precipFileNames{l} = strcat(pathstr(1:end-4), datestr(startTime, 'yyyy'), filesep, 'PRECIPRATE.',datestr(peakTime2, 'yyyymmdd.hhMMss'), '.tif');
peakTime2 = addtodate(peakTime2, -5, 'minute'); %No. of times we go back in time from peak time
end