octave: Comma Separated Lists

 
 6.3 Comma Separated Lists
 =========================
 
 Comma separated lists (1) are the basic argument type to all Octave
 functions - both for input and return arguments.  In the example
 
      max (A, B)
 
 ‘A, B’ is a comma separated list.  Comma separated lists can appear on
 both the right and left hand side of an assignment.  For example
 
      x = [1 0 1 0 0 1 1; 0 0 0 0 0 0 7];
      [I, J] = find (X, 2, "last");
 
 Here, ‘X, 2, "last"’ is a comma separated list constituting the input
 arguments of ‘find’.  ‘find’ returns a comma separated list of output
 arguments which is assigned element by element to the comma separated
 list ‘I, J’.
 
    Another example of where comma separated lists are used is in the
 creation of a new array with ‘[]’ (SeeMatrices) or the creation of
 a cell array with ‘{}’ (SeeBasic Usage of Cell Arrays).  In the
 expressions
 
      a = [1, 2, 3, 4];
      c = {4, 5, 6, 7};
 
 both ‘1, 2, 3, 4’ and ‘4, 5, 6, 7’ are comma separated lists.
 
    Comma separated lists cannot be directly manipulated by the user.
 However, both structure arrays and cell arrays can be converted into
 comma separated lists, and thus used in place of explicitly written
 comma separated lists.  This feature is useful in many ways, as will be
 shown in the following subsections.
 

Menu