find the index of the rows that have all 1

14 views (last 30 days)
Hi, I have a matrix
A= [ 0 0 0 0 0
0 1 1 1 1
1 1 1 0 0
0 0 0 0 1
0 0 0 1 0
1 1 1 1 1
0 1 1 1 1
0 1 1 1 0
0 0 1 1 1
1 1 1 1 1
0 0 0 1 0]
I want to find the index of the rows that have all 1, can you help me?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 7 Apr 2016
Edited: Azzi Abdelmalek on 7 Apr 2016
idx=find(all(A,2))

More Answers (0)

Community Treasure Hunt

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

Start Hunting!