I have data in a matrix where I need each consecutive row to be the average of all the rows above this. How would I go about this?

 채택된 답변

James Tursa
James Tursa 2018년 2월 21일
편집: James Tursa 2018년 2월 21일

0 개 추천

Assuming the average includes the row in question:
x = your matrix
result = cumsum(x)./(1:size(x,1))';
Or for earlier versions of MATLAB:
result = bsxfun(@rdivide,cumsum(x),(1:size(x,1))');

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 NaNs에 대해 자세히 알아보기

태그

질문:

2018년 2월 21일

댓글:

2018년 2월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by