matlab中如何求两个矩阵的交集
来源:学生作业帮助网 编辑:作业帮 时间:2024/05/04 18:45:05
matlab中如何求两个矩阵的交集
matlab中如何求两个矩阵的交集
matlab中如何求两个矩阵的交集
>> help intersect
INTERSECT Set intersection.
INTERSECT(A,B) for vectors A and B, returns the values common to the
two vectors. MATLAB sorts the results. A and B can be cell arrays of
strings.
INTERSECT(A,B,'rows') for matrices A and B that have the same number of
columns, returns the rows common to the two matrices. MATLAB ignores
the 'rows' flag for all cell arrays.
[C,IA,IB] = INTERSECT(A,B) also returns index vectors IA and IB
such that C = A(IA) and C = B(IB).
[C,IA,IB] = INTERSECT(A,B,'rows') also returns index vectors IA and IB
such that C = A(IA,:) and C = B(IB,:).
Class support for inputs A,B:
float: double, single
See also unique, union, setdiff, setxor, ismember.
Overloaded methods:
cell/intersect
ordinal/intersect
nominal/intersect
categorical/intersect
xregpointer/intersect
Reference page in Help browser
doc intersect