setdiff函數是什么?
1.setdiff函數set difference.
C=setdiff(A,B) for vector A and B, return the values in A that are not in B with no repetitions. C will be sorted.
對于向量A,向量B,C=setdiff(A,B)函數返回在向量A中卻不在向量B中的元素,并且C中不包含重復元素,并且從小到大排序。
[C,IA] = setdiff(A,B) also returns an index vector IA such that C = A(IA). If there are repeated values in A that are not in B, then the index of the first occurrence of each repeated value is returned.
返回值C同上,IA是C中元素在向量A中的下標(索引)。如果A中存在重復元素,并且該元素不在B中,就返回重復元素的第一次出現的下標。