我想在两个数组中找到共同的值(例如,如果A = [1 2 3 4 5 6]并且B = [9 8 7 6 3 1 2],结果是ans = [1 2 3 6]).是否存在没有使用循环的任何方法?
谢谢
我有两个字符串A和B的单元格数组.B的所有单元格也在A中.我想在A中找到B的单元格索引.谢谢.
例:
A=
'aaaa'
'bbbb'
'cccc'
'dddd'
'ffff'
B=
'ffff'
'aaaa'
ans=
5
1
Run Code Online (Sandbox Code Playgroud)
要么
ans=
1
5
Run Code Online (Sandbox Code Playgroud) 如何在两个单元格中找到共同元素的索引?
谢谢.
例如:
cell1= {
A
B
C
D
E
f
}
cell2= {
g
h
f
D
i
l
m
n
}
Run Code Online (Sandbox Code Playgroud)
例如,cell2中的D和f的返回索引具有3和4索引.
ans=
0
0
0
4
0
3
Run Code Online (Sandbox Code Playgroud)