location of logical matrix
Show older comments
Hi I have a 10 x 2 logical matrix and I would need to find out the location of the rows which both columns are ones i.e 1 1.
May I know how I may write for this? Thank you!
Accepted Answer
More Answers (1)
KSSV
on 22 Aug 2019
Read about ismember
idx = round(rand(10,2)) ;
vec = [1 1] ;
[c,ia] = ismember(idx,vec,'rows') ;
iwant = find(c) ;
idx(c,:)
idx(iwant,:)
Categories
Find more on Logical 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!