Colon

The colon operator has a number preceding and following it.

These numbers represent the (inclusive) range of the vector returned.

  • Used to make vectors. This works by (from:step:to) or (from:to) with a step of 1.
   Ex: [2:4] => [2,3,4]
   Ex: [2:.5:4] => [2,2.5,3,3.5,4]
  • Used when indexing an ENTIRE row or column of an array.
   Ex: Array = [1,2,3; 4,5,6; 7,8,9]
           Array(2,:) = [4,5,6]