| Contents | Index |
Set difference for categorical arrays
Note In a future release, the behavior of categorical.setdiff will change to be consistent with the MATLAB function setdiff. This behavior change is optional in R2012a. For a demonstration of using the 'R2012a' flag to preview the future behavior, or the 'legacy' flag to preserve the current behavior in your existing code, see the documentation for setdiff. |
C = setdiff(A,B)
[C,IA] = setdiff(A,B)
[...] = setdiff(A,B,'rows')
[...] = setdiff(...,'R2012a')
[...] = setdiff(...,'legacy')
[...] = setdiff(A,B,setOrder)
[...]
= setdiff(A,B,'rows',setOrder)
C = setdiff(A,B) for categorical vectors A and B, returns a categorical vector C containing the values in A that are not in B with no repetitions. The result C is sorted. The set of categorical levels for C is the sorted union of the sets of levels of the inputs.
[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 last occurrence of each repeated value is returned.
[...] = setdiff(A,B,'rows') for categorical matrices A and B with the same number of columns, returns the rows from A that are not in B. The rows of the matrix C are sorted. The set of categorical levels for C is the sorted union of the sets of levels of the inputs. The optional output IA is an index vector such that C = C(IA,:).
[...] = setdiff(...,'R2012a') adopts the future behavior of setdiff. You can specify the flag as the final argument with any previous syntax that accepts A, B, or 'rows'.
[...] = setdiff(...,'legacy') preserves the current behavior of setdiff. You can specify the flag as the final argument with any previous syntax that accepts A, B, or 'rows'.
[...] = setdiff(A,B,setOrder) and [...] = setdiff(A,B,'rows',setOrder) returns the observations of C in a specific order. setOrder='sorted' returns the values or rows of C in sorted order. setOrder='stable' returns the values or rows of C in the same order as A. If A is a row vector, then C is also a row vector. Otherwise, C is a column vector. IA is a column vector. 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.
intersect | ismember | setxor | union | unique
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |