質問

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
役に立ちましたか?

解決

You can use the second output argument of ismember for that purpose:

[~, index] = ismember(cell1, cell2);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top