필터 지우기
필터 지우기

Mean of some elements in a matrix

조회 수: 2 (최근 30일)
A Basu
A Basu 2017년 8월 13일
댓글: A Basu 2017년 8월 14일
I have a matrix A of dimension 25 x 51. I want to calculate the mean of every sequential 5 elements of each row and store them in another matrix. Precisely I want to compute mean(A(1:5,1)), mean(A(6:10,1)) and so on for all columns and save it in another matrix Q of dimension 5 x 51.
Can anyone help me out with the loop??

채택된 답변

Matt J
Matt J 2017년 8월 13일
편집: Matt J 2017년 8월 13일
Using SEPBLOCKFUN ( Download ),
result=sepblockfun(yourMatrix,[5,1],'mean');

추가 답변 (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