Réponse acceptée

Walter Roberson
Walter Roberson le 6 Juin 2012

16 votes

b = a(any(a,2),:);

5 commentaires

Rahul
Rahul le 6 Juin 2012
thanks Walter
Brodie Norfolk
Brodie Norfolk le 13 Avr 2017
walter cheers mate
Note: the above code treats nan values the same as zero values, so for example the row [0 nan nan] would also be removed. If that is not acceptable, then
b = a(any(a ~= 0,2),:);
Hi Walter,
Would you please explain this line?
b = a(any(a,2),:);
Shishir Bapat
Shishir Bapat le 11 Mar 2021
Thank you

Connectez-vous pour commenter.

Plus de réponses (1)

Geoff
Geoff le 6 Juin 2012

0 votes

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

Catégories

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by