How to compare an array with 2D matrix?
Ältere Kommentare anzeigen
If I have an array A= [1,2] and matrix B= [3,4;8,6;1,2], How can I say that array A is present in B?
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 21 Okt. 2016
Try ismember() with the 'rows' option:
[~, matchingRows] = ismember(A, B, 'rows')
3 Kommentare
Emmanuel
am 21 Okt. 2016
Image Analyst
am 21 Okt. 2016
Emmanuel, try this:
A= [1,2]
B= [3,4;8,6;1,2; 4,5; 1,2]
[inA, inB] = ismember(B, A, 'rows')
matchingRows = find(inB)
Emmanuel
am 21 Okt. 2016
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!