MATLAB Function Reference
  Go to function:
    Search    Help Desk 
ismember    Examples   See Also

Detect members of a set

Syntax

Description

k = ismember(a,S) returns an vector the same length as a containing logical true (1) where the elements of a are in the set S, and logical false (0) elsewhere. In set theoretic terms, k is 1 where a S. a and S can be cell arrays of strings.

k = ismember(A,S,'rows') when A and S are matrices with the same number of columns returns a vector containing 1 where the rows of A are also rows of S and 0 otherwise.

Examples

See Also

intersect   Set intersection of two vectors

setdiff     Return the set difference of two vectors

setxor      Set exclusive-or of two vectors

union       Set union of two vectors

unique      Unique elements of a vector



[ Previous | Help Desk | Next ]