$LastChangedDate$intersectreturns the vector of common values of two
vectorsCalling Sequence[v [,ka,kb]]=intersect(a,b)[v [,ka,kb]]=intersect(a,b,orient)Argumentsavector of numbers or stringsbvector of numbers or stringsorientflag with possible values : 1 or "r", 2 or "c"vrow vector of numbers or stringskarow vector of integerskbrow vector of integersDescriptionintersect(a,b) returns a sorted row vector of
common values of two vectors of a and
b.[v,ka,kb]=intersect(a,b) also returns index
vectors ka and kb such that
v=a(ka) and v=b(kb).intersect(a,b,"r") or
intersect(a,b,1)returns the matrix formed by the
intersection of the unique rows of a and
b sorted in lexicographic ascending order. In this case
matrices a and b must have the same
number of columns.[v,ka,kb]=intersect(a,b,"r") also returns index
vectors ka and kb such that
v=a(ka,:) and v=b(kb,:).intersect(a,b,"c") or
intersect(a,b,2)returns the matrix formed by the
intersection of the unique columns of a and
b sorted in lexicographic ascending order. In this case
matrices a and b must have the same
number of rows.[v,ka,kb]=intersect(a,b,"c") also returns index
vectors ka and kb such that
v=a(:,ka) and v=b(:,kb).RemarkNaN are considered as different from themselves so they are excluded
out of intersection in case of vector intersection.ExamplesSee Also
unique
gsort
union