121-Matlab study notes in the intersection of the vector, and union, difference set operation, etc.

Matlab vectors in the intersection, union, difference and the like set operations
a, as a function of set operations:

    INTERSECT (A, B): set intersection, A and B are vector
    union (A, B): set union
    setdiff ( a, B): set a minus set difference set B (if collection element a there is present in B, the result is null)
    isMember (a, a): determines whether the elements in the set
    sort (a): sorting of vectors
    issorted (a): determining whether a set of ordered
    setxor: a set of exclusive or (but not in the current collector and the intersection of the elements)
    UNIQUE: returns a collection of elements will not be repeated (the same element removed)

two, for example as follows:

a = [1,2,3,4,5,6];
B = [1,2,3,7,8,9];
C = [1,2,3,6,5,4,7,8,9 ];
D = [1,1,2,2,3,3]

INTERSECT (A, B); ANS% = [l, 2,3]
Union (A, B); ANS% = [l, 2,3 , 4,5,6,7,8,9]
setdiff (A, B) ANS% = [4,5,6]
setdiff (A, C) = Empty Matrix% ANS: 0. 1-by-
isMember (. 1, A);. 1% ANS =
Sort (C); ANS% = [1,2,3,4,5,6,7,8,9]
IsSorted (A); ANS% =. 1
setxor (A, B); ANS% = [4,5,6,7,8,9]
UNIQUE (D); ANS% = [l, 2,3]

Reference link: https://blog.csdn.net/shengchaohua163/article/details/78938955

Guess you like

Origin www.cnblogs.com/hechangchun/p/12080944.html