loop for sum and average for specific rows

4 ビュー (過去 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 Center および File ExchangeEarth, Ocean, and Atmospheric Sciences についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by