Yearly average but keeping matrix dimensions
1 回表示 (過去 30 日間)
古いコメントを表示
Hello
I am trying to compute the yearly average of a 365x121x240 array.
What I used to do before is:
average=nanmean(mat,1);
squeezenan=squeeze(mat,1);
This will give me the average but in a matrix with dimensions 121x240.
But in this case, I want to take the average of the 365 days, while keeping the new matrix dimensions as 365x121x240.
2 件のコメント
the cyclist
2020 年 3 月 9 日
For the moment, let's ignore the 3rd dimension.
Suppose matrix is this:
mat = [1 2;
4 5];
The mean along the 1st dimension is
average = [2.5 3.5];
How would you have wanted the 1st dimension treated, if you had wanted it to stay length 2? Did you want
average = [2.5 3.5
2.5 3.5];
?
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!