How do I find the mean of a multidimensional array?

조회 수: 7 (최근 30일)
Delany MacDonald
Delany MacDonald 2016년 3월 31일
댓글: Star Strider 2016년 3월 31일
How do i find the mean of a 21 x 6 array and get a single answer? When i try to do it I am given 6 answers.

채택된 답변

Star Strider
Star Strider 2016년 3월 31일
Use the single ‘:’ array reference to create a column vector out of any N-dimensional array:
A = randi(99, 6); % Create Data
MeanA = mean(A(:))
MeanA =
57.25
  댓글 수: 2
Delany MacDonald
Delany MacDonald 2016년 3월 31일
Oh duh lol Thank You!
Star Strider
Star Strider 2016년 3월 31일
My pleasure!
No ‘duh’, though. Really.
MATLAB is a large language with an accordingly large documentation. I’ve been here a while, I’ve been working with MATLAB since 1994, and I’m still learning about functions and features, especially since these expand with nearly every release.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by