MATLAB 的unique函数——数组矩阵的唯一值
MATLAB 的unique函数——求数组矩阵的唯一值
相关MathWork文档见此:unique数组中的唯一值
1、C = unique(A)A 中相同的数据,但是不包含重复项。C 已按照从小到大排序。

2、C = unique(A,___,'rows')C = unique(A,'rows',___)A 中的每一行视为单个实体,并按排序顺序返回 A 中的唯一行。必须指定 A,而 setOrder 和 occurrence 是可选的。
'rows' 选项不支持元胞数组。

3、[ 还可使用上述任何语法返回索引向量 C,ia,ic] = unique(___)ia 和 ic。
- 
如果 A是向量,则C = A(ia)且A = C(ic)。
- 
如果 A是矩阵或数组,则C = A(ia)且A(:) = C(ic)。
- 
如果指定了 'rows'选项,则C = A(ia,:)且A = C(ic,:)。
- 
如果 A是表或时间表,则C = A(ia,:)且A = C(ic,:)。
 
4、[、C,ia,ic] = unique(A,'legacy')
  [、C,ia,ic] = unique(A,'rows','legacy')
  [ 和 C,ia,ic] = unique(A,occurrence,'legacy')
  [ 保留 R2012b 和早期版本中 C,ia,ic] = unique(A,'rows',occurrence,'legacy')unique 函数的行为。
'legacy' 选项不支持分类数组、日期时间数组、持续时间数组、表或时间表。
 
只返回 ia 和 ic:

posted on 2018-07-01 16:19 CuriousZero 阅读(6916) 评论(0) 收藏 举报
 
                    
                     
                    
                 
                    
                 
                
            
         
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号