Hi, I have a matrix 62599x60 double. I want the average of the 60 columns in every row. The output should be a 62599x1 matrix.

 채택된 답변

Image Analyst
Image Analyst 2014년 12월 7일

1 개 추천

averagesAcrossColumns = mean(M, 2);

댓글 수: 1

If you want the sum, use sum() instead of mean().
sumsAcrossColumns = sum(M, 2);
If you want the min or max, it's slightly different in that you need to insert [] before the dimension argument.
minsAcrossColumns = min(M, [], 2);
maxsAcrossColumns = max(M, [], 2);

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

질문:

AA
2014년 12월 7일

댓글:

2014년 12월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by