作业帮 > 综合 > 作业

matlab中如何求两个矩阵的交集

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/27 19:55:54
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