Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Make largest four sums of rows in an matrix zero

1 visualización (últimos 30 días)
KJones
KJones el 30 de Nov. de 2016
Cerrada: Image Analyst el 7 de En. de 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 comentario
Alexandra Harkai
Alexandra Harkai el 30 de Nov. de 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?

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by