How do you find unique values in Matlab?
C = unique( A , setOrder ) returns the unique values of A in a specific order. setOrder can be 'sorted' (default) or 'stable' . C = unique( A , occurrence ) specifies which indices to return in case of repeated values. occurrence can be 'first' (default) or 'last' .
How to use diff in Matlab?
Y = diff( X ) calculates differences between adjacent elements of X along the first array dimension whose size does not equal 1: If X is a vector of length m , then Y = diff(X) returns a vector of length m-1 . The elements of Y are the differences between adjacent elements of X .
How does find work in Matlab?
k = find( X ) returns a vector containing the linear indices of each nonzero element in array X . If X is a vector, then find returns a vector with the same orientation as X . If X is a multidimensional array, then find returns a column vector of the linear indices of the result.