Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Make largest four sums of rows in an matrix zero
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Alexandra Harkai
il 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?
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!