## Documentation Center |

Set intersection of two arrays

`[C,ia,ib] = intersect(___,setOrder)`example

` C = intersect(A,B)` returns
the data common to both

If

`A`and`B`are numeric arrays, logical arrays, character arrays, categorical arrays, or cell arrays of strings, then`intersect`returns the values common to both`A`and`B`. The values of`C`are in sorted order.If

`A`and`B`are tables, then`intersect`returns the set of rows common to both tables. The rows of table`C`are in sorted order.

` C = intersect(A,B,'rows')` treats
each row of

The `'rows'` option does not support cell arrays.

`[ C,ia,ib]
= intersect(___,setOrder)` returns

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

Was this topic helpful?