finding the average in a matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
AA
am 7 Dez. 2014
Kommentiert: Image Analyst
am 7 Dez. 2014
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 Kommentare
Akzeptierte Antwort
Image Analyst
am 7 Dez. 2014
averagesAcrossColumns = mean(M, 2);
1 Kommentar
Image Analyst
am 7 Dez. 2014
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);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!