Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Jun. 2012

17 Stimmen

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

5 Kommentare

Rahul
Rahul am 6 Jun. 2012
thanks Walter
Brodie Norfolk
Brodie Norfolk am 13 Apr. 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 am 11 Mär. 2021
Thank you

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Geoff
Geoff am 6 Jun. 2012

0 Stimmen

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

Kategorien

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by