Calculation the mean of a portion of a matrix

1 visualizzazione (ultimi 30 giorni)
Hello!
I am having trouble finding out how can I calculate the mean of all the values in a 10x10 matrix (z) which do not lie along an edge of that same matrix (z)...
Thanks in advance!

Risposta accettata

Matt J
Matt J il 23 Feb 2021
Modificato: Matt J il 23 Feb 2021
mean( z(2:end-1,2:end-1) ,'all')
  3 Commenti
Matt J
Matt J il 23 Feb 2021
Modificato: Matt J il 23 Feb 2021
You're quite welcome, but please Accept-click the answer to indicate that it does what you need.
The 2:end-1 is equivalent in this context to 2:10-1 or 2:9. It as as if you had written z(2:9,2:9). See also,

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by