Reputation: 189
I have used the following code in MATLAB to delete the zero rows,
zero_rows = A(all(A,2),:);
I would like to know how to delete the non-zero rows.
Upvotes: 1
Views: 68
Reputation: 1033
Just use the not sign ~
or use any
non_zero_rows = A(~all(A,2),:);
or
zero_rows = A(any(A,2),:);
Upvotes: 2