Find elements of type (x,y) and indices for equality of columns x and y
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Find number of elements of type (x,y) in two columns, where x is in one column and y in the other. Report the indices for elements of type (x,y) that are equal.
Example a = [1,1,2,1]; b = [1,2,2,1]; should give answer (2,2) for index 3.
Antworten (1)
Ameer Hamza
am 4 Nov. 2020
Bearbeitet: Ameer Hamza
am 4 Nov. 2020
In case of given 'a' and 'b', same value occur in three rows
a = [1,1,2,1]; b = [1,2,2,1];
idx = find(a==b)
Result
>> idx
idx =
1 3 4
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!