loop for sum and average for specific rows

조회 수: 3 (최근 30일)
nada
nada 2020년 7월 28일
댓글: nada 2020년 7월 29일
Dear All
I have sea level data 300*1, it is monthly data for 25 years, the data in Excel file
Describing the row (1 JAN, 2 Feb, 3 Mar........ 12 Dec, 13 JAN, 14 Feb, 15 Mar............ 300 Dec )
I want to use a loop to work (sum and average each month) and the final result will be 12*1
Many Thanks in advance

채택된 답변

KSSV
KSSV 2020년 7월 28일
A = rand(300,1) ;
B = reshape(A,12,[]) ;
thesum = sum(B,2) ;
themean = mean(B,2) ;
  댓글 수: 1
nada
nada 2020년 7월 29일
All thanks and appreciation KSSV

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by