Hi all,
I have a 3d matrix with a dimension of 21*41*273, for which I want to do the running mean over the third dimension (273 days) for every 4 days.
Any help would be appreciated.

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 22 日

0 投票

Try something like this
M = rand(21, 41, 273);
M_new = movmean(M, [0 3], 3, 'Endpoints', 'discard');
M_new = M_new(:,:,1:4:end);

5 件のコメント

Lilya
Lilya 2020 年 10 月 22 日
My apprecited. Solved!
Ameer Hamza
Ameer Hamza 2020 年 10 月 22 日
I am glad to be of help!
Lilya
Lilya 2020 年 10 月 25 日
Hi Sir Ameer, I have a small question here in this line:
M_new = movmean(M, [0 3], 3, 'Endpoints', 'discard');
What does the [0 3] refer to? I've checked it and it seems that it takes the data from 0 to 3. Am I understand it correctly?
also the ,3, in the line is it for 4 elements mean?
Thanks
Ameer Hamza
Ameer Hamza 2020 年 10 月 25 日
Yes, It means that it takes data from the current value and the next three values.
Lilya
Lilya 2020 年 10 月 25 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2020 年 10 月 22 日

コメント済み:

2020 年 10 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by