Reputation: 197
How to find index of common elements in two cells?
Thanks.
for example:
cell1= {
A
B
C
D
E
f
}
cell2= {
g
h
f
D
i
l
m
n
}
return index of D and f in cell2 for example have 3 and 4 index.
ans=
0
0
0
4
0
3
Upvotes: 1
Views: 75
Reputation: 9864
You can use the second output argument of ismember
for that purpose:
[~, index] = ismember(cell1, cell2);
Upvotes: 5