Mean of matrix by columns
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello! I'm looking for a function to get the mean of two (or more) columns:
A = 1 2 3
4 5 6
7 8 9
f(A) =
1.5000 2.5000
4.5000 5.5000
7.5000 8.5000
How can I do that in a simple way, for a generic matrix? Thank you.
댓글 수: 0
채택된 답변
추가 답변 (2개)
sixwwwwww
2013년 10월 13일
편집: sixwwwwww
2013년 10월 13일
Dear Alessandro, you can use MATLAB function "mean" for this purpose. Here is description: http://www.mathworks.com/help/matlab/ref/mean.html. In Your case just use
mean(A)
댓글 수: 6
sixwwwwww
2013년 10월 13일
I think in anyway you will need to use at least one for loop. However if I will have better idea then I will come back to it
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!