Mean of multidimensional array

3 vues (au cours des 30 derniers jours)
Louise Wilson
Louise Wilson le 10 Déc 2021
Commenté : Louise Wilson le 10 Déc 2021
I have a multidimensional array: 1000x72x4.
I would like to know the mean of all four sheets and so provide a single 1000x72 matrix.
mdar(:,:)=randi(1000,72,1000);
mdar(:,:,2)=randi(1000,72,1000);
mdar(:,:,3)=randi(1000,72,1000);
mdar(:,:,4)=randi(1000,72,1000);
mdar_mean=mean(mdar,[1 3]); %gives a 1000*1 array

Réponse acceptée

James Tursa
James Tursa le 10 Déc 2021
Doesn't mean(mdar,3) do what you want?
  1 commentaire
Louise Wilson
Louise Wilson le 10 Déc 2021
It does! Somehow I overlooked that. Thank you!!!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by