Matlab, finding common values in two array
12,693
use intersect(A,B)
to get the answer.
Another option is to use ismember
, for example A(ismember(A,B))
.
Author by
Fatime
Updated on June 24, 2022Comments
-
Fatime almost 2 years
I want to find common values in two arrays(For example if A=[1 2 3 4 5 6] and B=[9 8 7 6 3 1 2] the result is ans=[1 2 3 6]).Is there any method without using loop?
Thanks