Set Operations
MATLAB 没有所谓集合 set 数据类型, 这里的集合就是指的 Matlab Array, 其中元素可以为任意数据类型.
Functions
MATLAB 没有集合运算的运算符, 只有通过简单函数实现运算.
| Functions | Description |
|---|---|
| intersect | Set intersection of two arrays |
| ismember | Array elements that are members of set array |
| setdiff | Set difference of two arrays |
| setxor | Set exclusive OR of two arrays |
| union | Set union of two arrays |
| unique | Unique values in array |
| ismembertol | Members of set 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 |
/! Tolerance
- MATLAB 中一个常见的问题就是因为浮点数精度的原因, 两个数字很难完全相等, 所以可以用 …tol 函数来接受允许误差
- MATLAB 默认 tolerance 为
- single 类: 1e-6
- double 类: 1e-12