Deleting every row with a zero in the first column, except the first row
5 views (last 30 days)
Show older comments
I have the following Matrix A
A = [0 0; 2 5; 3 6; 7 0; 0 5; 0 3]
I'd like to delete every row that has a 0 in the first column, except the first one.
So thats my code so far
A(all(A(2:end,1)==0,2),:)=[];
it works just as I'd like it to, but it always deletes the 4th row and gives me instead the last one.
Thanks for any help
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!