フィルターのクリア

Averaging rows with rows previous

3 ビュー (過去 30 日間)
WBOZ11
WBOZ11 2018 年 2 月 21 日
コメント済み: WBOZ11 2018 年 2 月 22 日
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 日
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))');
  1 件のコメント
WBOZ11
WBOZ11 2018 年 2 月 22 日
Thank you so much!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by