フィルターのクリア

How to calculate cumulative average of every n values in a matrix?

1 回表示 (過去 30 日間)
Parthu P
Parthu P 2019 年 11 月 22 日
回答済み: Parthu P 2019 年 11 月 22 日
Hi, I have 300x20 matrix (A). How to calculate average of every 3 consecutive rows of each column to have output matrix B (100x20)?

採用された回答

Ridwan Alam
Ridwan Alam 2019 年 11 月 22 日
B = (A(1:3:end,:)+A(2:3:end,:)+A(3:3:end,:))/3

その他の回答 (2 件)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 11 月 22 日
solution:
mean100x20=reshape(mean(reshape(A,3,[])),100,[])

Parthu P
Parthu P 2019 年 11 月 22 日
Thank you both.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by