Member of the membership class.
c = ismember(a, b)
c = ismember(a, b, 'rows')
[c, d] = ismember(a, b)
[c, d] = ismember(a, b, 'rows')
Determines whether an element in one matrix is an element of another matrix. If you specify 'rows', a and b must have the same number of columns, and ismember(a, b, 'rows') determines whether the rows of a are in b.
| Name | Description |
| a | Specifies a matrix. |
| b | Specifies a matrix. |
| Name | Description |
| c | Returns a matrix of Boolean values. An element in c is 1 if and only if the corresponding element of a is a member of b. Otherwise, the element is 0. c is a matrix of the same size as a. c is a vector or matrix. |
| d | Returns the positions in b of the elements of a. If an element in a is not in b, the corresponding element in d is 0. d is a vector of integers. |
A = [1, 2, 3, 4, 5, 6, 7, 8, 9]
B = [2, 3, 5, 7]
C = ismember(A, B)