Calculation the mean of a portion of a matrix

1 回表示 (過去 30 日間)
Moheb Amir Adel Kamel Rafla
Moheb Amir Adel Kamel Rafla 2021 年 2 月 23 日
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!

採用された回答

Matt J
Matt J 2021 年 2 月 23 日
編集済み: Matt J 2021 年 2 月 23 日
mean( z(2:end-1,2:end-1) ,'all')
  3 件のコメント
Matt J
Matt J 2021 年 2 月 23 日
編集済み: Matt J 2021 年 2 月 23 日
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,
Moheb Amir Adel Kamel Rafla
Moheb Amir Adel Kamel Rafla 2021 年 2 月 23 日
Ah ok I get it! Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by