String matrix compare to get common in rows
Ältere Kommentare anzeigen
Deal all, i have a problem to compare two string matrix :
A1 = {'AA', 'b' ; 'cc', 'ff'}
A2 = {'ee', 'AA' ; 'hhh', 'm'}
strcmp(A1,A2)
I get
A1 =
'AA' 'b'
'cc' 'ff'
A2 =
'ee' 'AA'
'hhh' 'm'
ans =
0 0
0 0
But i need to get
'AA' is common between A1 iand A2 in the row 1
Best regard
Akzeptierte Antwort
Weitere Antworten (1)
Geoff Hayes
am 27 Jun. 2019
>> ismember(A1,A2)
ans =
1 0
0 0
5 Kommentare
Touts Touts
am 27 Jun. 2019
Geoff Hayes
am 27 Jun. 2019
So if 'AA' is in the second row, do you expect to see
'AA' : 2
? What happens if 'AA' is in more than one row?
Touts Touts
am 27 Jun. 2019
- what happens if 'AA' occurs on different rows?
- what happens if 'AA' occurs multiple times within one matrix?
Touts Touts
am 28 Jun. 2019
Kategorien
Mehr zu Interpolation finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!