Compare 2 vectors together

3 ビュー (過去 30 日間)
Steven
Steven 2012 年 9 月 9 日
Hi,
Let's say we have 2 vectors of different lenght, values (but there's not 2 values identical in the same vector) and not sorted. What's the quickest way to have all the values that are the same. For example :
a = [0 5 4 88 18 26 33]
b = [2 4 17 3 26]
c = someFunction(a,b);
==> c = [4 26];
Thank you

採用された回答

Dishant Arora
Dishant Arora 2012 年 9 月 9 日
intersect(a,b);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by