Mean of highest n numbers for each row in a matrix
1 回表示 (過去 30 日間)
古いコメントを表示
Hi Everyone,
Suppose I have a matrix A, which has r rows and c columns.
For each of the rows A, I wish to find the mean of the highest n numbers, to create B, which is a 1,c matrix, containing these means.
How can this be done?
Regards
Ulrik
0 件のコメント
採用された回答
Sean de Wolski
2011 年 7 月 15 日
A = sort(Matrix,2,'descend'); %sort it so big numbers first
B = mean(A(:,1:n),2) %mean them
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!