finding the average in a matrix
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Image Analyst
2014-12-7
averagesAcrossColumns = mean(M, 2);
1 个评论
Image Analyst
2014-12-7
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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!