Average the 3rd dimension in a matrix

3 vues (au cours des 30 derniers jours)
Jonas Damsbo
Jonas Damsbo le 4 Jan 2019
Commenté : Jonas Damsbo le 4 Jan 2019
I have a 360x181x360.
I want to average the 3rd dimension with 4, so I get a new matrix like 360x181x90.
How can I do that?

Réponse acceptée

Bruno Luong
Bruno Luong le 4 Jan 2019
Modifié(e) : Bruno Luong le 4 Jan 2019
Mean every 4 indices of the third dimension
A=rand(360,181,360);
[m,n,p] = size(A);
m = mean(permute(reshape(A,m,n,4,[]),[1 2 4 3]),4)
  1 commentaire
Jonas Damsbo
Jonas Damsbo le 4 Jan 2019
Thanks! It's working!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by