using ismember with different arrays

4 ビュー (過去 30 日間)
shamal
shamal 2025 年 3 月 22 日
回答済み: Voss 2025 年 3 月 23 日
a=[4 6 1 2]
a = 1×4
4 6 1 2
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
b=[4 2 1 9]
b = 1×4
4 2 1 9
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
c=[8 0 5 4]
c = 1×4
8 0 5 4
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
[n,m]=ismember(a,b,c); %How can i do it?
Error using ismember (line 118)
Invalid input. Valid flags are 'rows', 'legacy'.
Answer is 4... the 4 is in a,b and c

採用された回答

Voss
Voss 2025 年 3 月 23 日
a=[4 6 1 2];
b=[4 2 1 9];
c=[8 0 5 4];
intersect(a,intersect(b,c))
ans = 4

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by