Set Operations
Set operations compare the elements in two sets to find commonalities or differences. In MATLAB®, the sets can be arrays of numbers, dates, times, tables, timetables, or text data.
Most set operations compare sets for exact equality, which can be
problematic in the context of floating-point arithmetic. For that reason,
the ismembertol
and uniquetol
functions are also available to perform comparisons with a tolerance.
Functions
intersect | Intersection of two sets of data |
ismember | Find set members of data |
setdiff | Difference of two sets of data |
setxor | Exclusive OR of two sets of data |
union | Union of two sets of data |
unique | Unique values |
ismembertol | Find set members of data within tolerance |
uniquetol | Unique values within tolerance |
join | Combine two tables or timetables by rows using key variables |
innerjoin | Inner join between two tables or timetables |
outerjoin | Outer join between two tables or timetables |
Topics
- Average Similar Data Points Using a Tolerance
This example shows how to average a group of points that are within tolerance. This approach produces a reduced data set that still holds the general shape of the original data.
- Group Scattered Data Using a Tolerance
This example shows how to group scattered data points based on their proximity to points of interest.