MATLAB Function Reference Previous page   Next Page
ismember

Detect members of set

Syntax

Description

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

tf = 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. You cannot use this syntax if A or S is a cell array of strings.

[tf, loc] = ismember(A, S, ...) returns index vector loc containing the highest index in S for each element in A that is a member of S. For those elements of A that do not occur in S, ismember returns 0.

Examples

See Also

issorted, intersect, setdiff, setxor, union, unique, is*


Previous page  islogical ismethod Next page

© 1994-2005 The MathWorks, Inc.