Azzera filtri
Azzera filtri

remove rows with all zeros

216 visualizzazioni (ultimi 30 giorni)
Rahul
Rahul il 6 Giu 2012
Commentato: Shishir Bapat il 11 Mar 2021
I have
a =
1 2 3
0 0 0
2 1 0
4 5 0
0 0 0
2 0 1
I need
b=
1 2 3
2 1 0
4 5 0
2 0 1

Risposta accettata

Walter Roberson
Walter Roberson il 6 Giu 2012
b = a(any(a,2),:);
  5 Commenti
Mohamed Nedal
Mohamed Nedal il 20 Dic 2019
Hi Walter,
Would you please explain this line?
b = a(any(a,2),:);
Shishir Bapat
Shishir Bapat il 11 Mar 2021
Thank you

Accedi per commentare.

Più risposte (1)

Geoff
Geoff il 6 Giu 2012
Search facility on Answers shows this question is asked a lot... Here's one of the more recent.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by