# ismember

Array elements that are members of set array

## Syntax

## Description

returns an array containing logical `Lia`

= ismember(`A`

,`B`

)`1`

(`true`

) where the data in `A`

is found in
`B`

. Elsewhere, the array contains logical
`0`

(`false`

).

If

`A`

and`B`

are tables or timetables, then`ismember`

returns a logical value for each row. For timetables,`ismember`

takes row times into account to determine equality. The output,`Lia`

, is a column vector.

treats each row of `Lia`

= ismember(`A`

,`B`

,'rows')`A`

and each row of `B`

as
single entities and returns a column vector containing logical
`1`

(`true`

) where the rows of
`A`

are also rows of `B`

. Elsewhere, the
array contains logical `0`

(`false`

).

The `'rows'`

option does not support cell arrays, unless one
of the inputs is either a categorical array or a datetime array.

`[`

also returns an array, `Lia`

,`Locb`

]
= ismember(___)`Locb`

, using any of the previous syntaxes.

Generally,

`Locb`

contains the lowest index in`B`

for each value in`A`

that is a member of`B`

. Values of`0`

indicate where`A`

is not a member of`B`

.If the

`'rows'`

option is specified, then`Locb`

contains the lowest index in`B`

for each row in`A`

that is also a row in`B`

. Values of`0`

indicate where`A`

is not a row of`B`

.If

`A`

and`B`

are tables or timetables, then`Locb`

contains the lowest index in`B`

for each row in`A`

that is also a row in`B`

. Values of`0`

indicate where`A`

is not a row of`B`

.

## Examples

## Input Arguments

## Output Arguments

## Tips

Use

`ismembertol`

to perform comparisons between floating-point numbers using a tolerance.To find the rows from table or timetable

`A`

that are found in`B`

with respect to a subset of variables, you can use column subscripting. For example, you can use`ismember(A(:,`

, where),B(:,`vars`

))`vars`

is a positive integer, a vector of positive integers, a variable name, a cell array of variable names, or a logical vector. Alternatively, you can use`vars`

`vartype`

to create a subscript that selects variables of a specified type.

## Extended Capabilities

## Version History

**Introduced before R2006a**