Average of 3d matrix

2 ビュー (過去 30 日間)
Lilya
Lilya 2020 年 6 月 9 日
コメント済み: mohamad shirgholami 2020 年 12 月 14 日
Hi All,
I have 3D matrix with dimension (61,57,273) the 273 is daily time. 39 weeks has 273 days.
I want to do a weekly average overtime to get (61,57,39).
result = reshape(data,61,57,39,7);
Data_mean = nanmean(result,4);
I am not sure about the reshaping. Any help would be appreciated to correct or suggest another way to do the average.
  1 件のコメント
mohamad shirgholami
mohamad shirgholami 2020 年 12 月 14 日
I have 3D matrix with dimension (61,57,365) the 365 is daily time. I want to do a monthly average overtime to get (61,57,12). But the number of days each month is different. I would be grateful for your help

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 6 月 9 日
result = reshape(data,61,57,7,39);
Data_mean = permute(nanmean(result,3), [1 2 4 3]) %permute gets rid of the singleton dimension that results
  1 件のコメント
Lilya
Lilya 2020 年 6 月 9 日
Thank you very much!!

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

その他の回答 (0 件)

カテゴリ

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