一组数 在 另一组数里 的所有位置。

假设有数组A和B
A是一组不重复的数,
B是一组有重复数的数组,里面包含A的部分元素
请问如何找到数组A元素在B数组里的所有位置?
我只会一个一个筛选,
for i = 1:length(A)
ind = find(B ==A(i))
end
然后把所有ind的值集合起来

 採用された回答

bueyserx
bueyserx 2023 年 5 月 19 日

0 投票

就只有这种方法了呀,ismember没办法解决,省略写就只有arrayfun(@(x) find(x == B), A, 'un', false)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

タグ

質問済み:

2023 年 5 月 19 日

回答済み:

2023 年 5 月 19 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!