필터 지우기
필터 지우기

how to make hourly, daily monthly rainfall in matlab?

조회 수: 4 (최근 30일)
Milad
Milad 2016년 5월 25일
댓글: Milad 2016년 6월 3일
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.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2016년 5월 25일
편집: Andrei Bobrov 2016년 5월 30일
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
Andrei Bobrov
Andrei Bobrov 2016년 5월 30일
Corrected.
Milad
Milad 2016년 6월 3일
hi Andrei Hope you re fine. thanks for you previous codes. May I have request from you..... if you are free ...... I attached previous file and i would do a revision on it to show data for each hour, day, month.I make a small sample in excel in sheet 2 just for two hour and two day and two months for you to show my subject. do you think, can revise the our commands for that sample. cheers

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by