octave: Sets

 
 27 Sets
 *******
 
 Octave has a number of functions for managing sets of data.  A set is
 defined as a collection of unique elements and is typically represented
 by a vector of numbers sorted in ascending order.  Any vector or matrix
 can be converted to a set by removing duplicates through the use of the
 ‘unique’ function.  However, it isn’t necessary to explicitly create a
 set as all of the functions which operate on sets will convert their
 input to a set before proceeding.
 
  -- : unique (X)
  -- : unique (X, "rows")
  -- : [Y, I, J] = unique (...)
  -- : [Y, I, J] = unique (..., "first")
  -- : [Y, I, J] = unique (..., "last")
      Return the unique elements of X sorted in ascending order.
 
      If the input X is a column vector then return a column vector;
      Otherwise, return a row vector.  X may also be a cell array of
      strings.
 
      If the optional argument "rows" is given then return the unique
      rows of X sorted in ascending order.  The input must be a 2-D
      matrix to use this option.
 
      If requested, return index vectors I and J such that ‘Y = X(I)’ and
      ‘X = Y(J)’.
 
      Additionally, if I is a requested output then one of "first" or
      "last" may be given as an input.  If "last" is specified, return
      the highest possible indices in I, otherwise, if "first" is
      specified, return the lowest.  The default is "last".
 
      See also: Seeunion XREFunion, Seeintersect XREFintersect,
DONTPRINTYET       Seesetdiff XREFsetdiff, Seesetxor XREFsetxor, *noteDONTPRINTYET       Seesetdiff XREFsetdiff, Seesetxor XREFsetxor, See
      ismember XREFismember.
 

Menu