フィルターのクリア

Mean of highest n numbers for each row in a matrix

2 ビュー (過去 30 日間)
Ulrik Nash
Ulrik Nash 2011 年 7 月 15 日
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

採用された回答

Sean de Wolski
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 件のコメント
Friedrich
Friedrich 2011 年 7 月 15 日
Litle typo:
A = sort(Matrix,2,'descend');
Sean de Wolski
Sean de Wolski 2011 年 7 月 15 日
In your words, doh!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by