how to make hourly, daily monthly rainfall in matlab?
2 views (last 30 days)
Show older comments
Dear colleagues I have excel file to show rainfall in each minute. I would have rainfall in hourly, daily and monthly. It means that i need to sum each hour to show hourly (cumulative). and sum each day to show daily and each month for showing monthly rainfall (cumulative). I read some codes from internet but i cant run them. I am new in matlab and I need to do this job. I attached the excel file as small sample but my data are growing each day.
0 Comments
Accepted Answer
Andrei Bobrov
on 25 May 2016
Edited: Andrei Bobrov
on 30 May 2016
data = xlsread('rain.xlsx');
[y,mm,d,h,m] = datevec(data(:,1) + datenum([1900 0 0]) - 1);
cum_minutes = [y,mm,d,h,m, cumsum(m)];
[hy,~,hc] = unique([y,mm,d,h],'rows');
cum_hourly = [hy, cumsum(accumarray(hc,data(:,2)))];
[dy,~,dc] = unique([y,mm,d],'rows');
cum_daily = [dy, cumsum(accumarray(dc,data(:,2)))];
[mhy,~,mhc] = unique([y,mm],'rows');
cum_monthly = [mhy, cumsum(accumarray(mhc,data(:,2)))];
7 Comments
More Answers (0)
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!