location of logical matrix
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Cside
am 22 Aug. 2019
Kommentiert: madhan ravi
am 22 Aug. 2019
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!
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 22 Aug. 2019
Bearbeitet: madhan ravi
am 22 Aug. 2019
Since you have a logical matrix it’simply:
ix=all(matrix ,2); % logical indexing is efficient
Wanted=find(ix)
6 Kommentare
madhan ravi
am 22 Aug. 2019
While learning always visualize with a simple and short example to understand what's going on.
Weitere Antworten (1)
KSSV
am 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,:)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!