The colon : alone as an index

If an index consists of a single colon, then it is equivalent to 1 : $. For example, A[1, :] returns the first row, A[:, 3] returns the third column.
>> A = [8, 1, 6; 3, 5, 7; 4, 9, 2]
   8    1    6
   3    5    7
   4    9    2
>> A[1, :]   // the first row
   8    1    6
>> A[:, 2]   // the second column
   1
   5
   9
>> A[1 : 2, :]  // the first two rows
   8    1    6
   3    5    7


oz 2009-12-22