Info

此问题已关闭。 请重新打开它进行编辑或回答。

Make largest four sums of rows in an matrix zero

1 次查看(过去 30 天)
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