average for each year

조회 수: 1 (최근 30일)
sky walker
sky walker 2021년 7월 12일
댓글: sky walker 2021년 7월 12일
i have this Matrix, consisting of 3 columns: Column 1: long Column 2: lat Column 3: year
lets say 97x281x15,
I want to make average for each year. so i want the result is 1x15, or 15x1
or kind of look like this
YEAR / DATA AVERAGE
1995 25.786
1996 25.686
1997 25.746
1998 25.686
and so on
Thank you for your suggestions.
  댓글 수: 2
Ive J
Ive J 2021년 7월 12일
If you're matrix has 3 columns, the size should be of size rowX3, can you upload a subset of your data (mat/delimited file)?
sky walker
sky walker 2021년 7월 12일
here is my file, thanks for your time

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

채택된 답변

Matt J
Matt J 2021년 7월 12일
편집: Matt J 2021년 7월 12일
In recent Matlab,
mean(SSTmonth,[1,2])
In older Matlab,
mean(reshape(SSTmonth,[],15),1)
  댓글 수: 3
Matt J
Matt J 2021년 7월 12일
편집: Matt J 2021년 7월 12일
Apparently your array is not 97x281x15 because if so there is no way that 15 would not be divisible into the number of elelments.
sky walker
sky walker 2021년 7월 12일
oh sorry, my bad. thanks for your help.

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

추가 답변 (0개)

카테고리

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