필터 지우기
필터 지우기

Calculation the mean of a portion of a matrix

조회 수: 3 (최근 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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by