Indices to zeros in Matrix
Show older comments
Suppose:
A =
4 5 1 3
5 1 3 4
5 0 0 0
6 0 0 0
4 0 0 0
4 0 0 0
3 0 0 0
I want to find the indices to the rows that contain 0 and I used:
[r,c]=find(A==0)
However, r returned
3
4
5
6
7
3
4
5
6
7
3
4
5
6
7
Why is this so? Shouldn't it return 3,4,5,6,7 only?
Accepted Answer
More Answers (1)
Azzi Abdelmalek
on 10 Sep 2013
find(any(~A,2))
Categories
Find more on Matrix Indexing 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!