Effacer les filtres
Effacer les filtres

Adding layers of a boolean matrix

1 vue (au cours des 30 derniers jours)
Emma
Emma le 14 Oct 2012
I have a series of 2400x2400x46 double matrices, all comprised of 0s and 1s. I would like to add all of the layers of each matrix then divide by the total number of layers (46). The result would be a 2400x2400x1 matrix (comprised of the sums of 0-46 divided by 46).
How might I go about doing this?
Thank you!

Réponse acceptée

Walter Roberson
Walter Roberson le 14 Oct 2012
mean(YourMatrix, 3)
Works even if YourMatrix is of datatype logical instead of double
  1 commentaire
Emma
Emma le 14 Oct 2012
Excellent- thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Operating on Diagonal 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