Using the sum function

조회 수: 10 (최근 30일)
Farai Mwashita
Farai Mwashita 2014년 10월 28일
댓글: Andrew Reibold 2014년 10월 28일
Hello
I have a variable dailyHDD=(1x365) which represents the daily temperature for each day of the year. I am trying to calculate the total for each month and I am not sure sure to do it, In this column 1-31 will be january month. please can you assist on how to break this into 12 months and calculate the total for each month.
Regards
Farai
  댓글 수: 1
Andrew Reibold
Andrew Reibold 2014년 10월 28일
....You say the 'total' for each month as if you want the sum. Your situation however makes it sound more practical to have the mean.
Do you really want the sum?

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

답변 (1개)

Matt J
Matt J 2014년 10월 28일
편집: Matt J 2014년 10월 28일
[~,m]=datevec(1:365);
totals=accumarray(m,dailyHDD(:))

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by