Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Make largest four sums of rows in an matrix zero

1 回表示 (過去 30 日間)
KJones
KJones 2016 年 11 月 30 日
閉鎖済み: Image Analyst 2017 年 1 月 7 日
Currently I have code to make the row with the maximum sum in the matrix equal zero, however I need to make the four largest sum rows equal zero. How do I go about doing this? Below is my current code:
A=createsrandomnetwork(10,3);
U=sum(A) %sum of matrix rows
M=max(U)
maxsum = max(U);
A(U == maxsum, :) = 0; %rows and columes
A(:, U == maxsum) = 0;
A(U > M, :) = 0;
A(:, U > M) = 0
  1 件のコメント
Alexandra Harkai
Alexandra Harkai 2016 年 11 月 30 日
What result are you expecting when there are more than one rows with the maximum sum? This leads to the question of what you exactly mean by 'four largest sum rows'?
For example, what would be the four largest if your row sums are 2,2,2,3,3?

回答 (0 件)

この質問は閉じられています。

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by