A[index]where A is a matrix of any numerical type. The index can have a single part, or two parts separated by a comma, or two parts separated by a semicolon, or more (3+) parts separated by commas.
The value of the indexing expression is a column vector
Colon Operator for creating evenly spaced vector
If a and b are two real scalar, a : b returns a row vector of numbers a, a+1, a+2, up to b, or the largest number a+n such that a+n <= b. If a<b+1, then a : b returns empty matrix.
>> v = 1 : 5 1 2 3 4 5 >> v = 1.2 : 5.3 1.2 2.2 3.2 4.2 5.2 >> v = 3 : -1 []
If a<b are two real numbers, and h>0, then a : h : b returns a row vector of numbers a, a+h, a+2h, up to b, or the largest number a+nh such that a+nh <= b.
If a>b, and h<0, then a : h : b returns a row vector of numbers a, a+h, a+2h, down to b, or the smallest number a+nh such that a+nh> b. a : b returns empty matrix.
>> v = 1 : 2 : 10 1 3 5 7 9 >> v = 1.2 : -1 : -5 1.2 -0.2 -1.2 -2.2 -3.2 -4.2
oz 2009-12-22