Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Array elements that are members of set array

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(`A`

,`B`

)`Locb`

.

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

`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`

.

Was this topic helpful?