Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Make largest four sums of rows in an matrix zero

1 view (last 30 days)
KJones
KJones on 30 Nov 2016
Closed: Image Analyst on 7 Jan 2017
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 Comment
Alexandra Harkai
Alexandra Harkai on 30 Nov 2016
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?

Answers (0)

This question is closed.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!