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 CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by