## Documentation Center |

Array elements that are members of set array

`[Lia,Locb] = ismember(___,'legacy')`example

` Lia = ismember(A,B)` returns
an array containing

If

`A`and`B`are numeric arrays, logical arrays, character arrays, categorical arrays, or cell arrays of strings, then`ismember`returns a logical value for each element of`A`. The output,`Lia`, is an array of the same size as`A`.If

`A`and`B`are tables, then`ismember`returns a logical value for each row of`A`. The output,`Lia`, is a column vector with the same number of rows as`A`.

` Lia = ismember(A,B,'rows')` treats
each row of

`A` and `B` must have the
same number of columns when you use the `'rows'` option.
Furthermore, the `'rows'` option does not support
cell arrays.

`[ Lia,Locb]
= ismember(A,B)` also
returns an array,

If

`A`and`B`are numeric arrays, logical arrays, character arrays, categorical arrays, or cell arrays of strings, then`Locb`contains the lowest index in`B`for each value in`A`that is a member of`B`. The output array,`Locb`, contains`0`wherever`A`is not a member of`B`.If

`A`and`B`are tables, then`Locb`contains the lowest index in`B`for each row in`A`that is also a row in`B`. The output vector,`Locb`, contains`0`whenever`A`is not a row of`B`.

`intersect` | `issorted` | `setdiff` | `setxor` | `sort` | `union` | `unique`

Was this topic helpful?