averaging the matrix and creating an averaged matrix

5 ビュー (過去 30 日間)
Lev Mihailov
Lev Mihailov 2020 年 7 月 27 日
コメント済み: Turlough Hughes 2020 年 7 月 27 日
Hello! I need to simultaneously average a section of the matrix, and I don't quite understand how to do it?
Expl=rand(265,1010); % I need to average rows by 5 instead of 10 columns % MatrixEx=mean(Expl(1:5,1:100))
% ExplAver 53x101
  1 件のコメント
Turlough Hughes
Turlough Hughes 2020 年 7 月 27 日
Needing to average rows by 5 instead of 10 columns, what exactly do you mean by that? How are you expecting to get to an output matrix with size 53x101?

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

回答 (1 件)

Turlough Hughes
Turlough Hughes 2020 年 7 月 27 日
As far as I understand you want the average of each 5 rows by 10 columns hence the expected output size of 53x101. You can do that with the block processing as follows:
ExplAver = blockproc(Expl,[5 10],@(block_struct) mean(block_struct.data,'all'));

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by