Friday, 6 June 2014

intersect 例子

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.

For example, A=[1 2 3], B= [ 2 3 4]
The result of intersect(A,B) should be [2 3]

[dummy, indexA, indexB] = intersect(A,B)

dummy = [2 3]
indexA = [1 2]
indexB = [2 3]

No comments:

Post a Comment