C = COUNTMEMBER(A,B) counts the number of times the elements of array A are present in array B, so that C(k) equals the number of occurences of A(k) in B. A may contain non-unique elements. C will have the same size as A.
A and B should be of the same type, and can be cell array of strings.
countmember([1 2 1 3],[1 2 2 2 2])
-> 1 4 1 0
-> 2 0 0
See also ismember, unique, histc
(v1.2, dec 2008)