필터 지우기
필터 지우기

Find the mean of every 5 values in an array

조회 수: 7 (최근 30일)
Lanceric Tse
Lanceric Tse 2018년 8월 13일
답변: Geoff Hayes 2018년 8월 13일
Hi, so I have an array of double
b=[ 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0]
How do I obtain the mean of every 5 values?

채택된 답변

Geoff Hayes
Geoff Hayes 2018년 8월 13일
Lanceric - try using reshape to change your array from a 1x20 to a 5x4 array and then compute the mean from that. For example,
mean(reshape(b,[5,4]))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by