Symbol Symbol Name Role Description Examples: Colon- Vector creation
- Indexing
- For-loop iteration
Use the colon operator to create regularly spaced vectors, index into arrays, and define the bounds
of a for loop.- colon
- “Creating, Concatenating, and Expanding Matrices”
Create a vector:x = 1:10Create a vector that increments by 3:x = 1:3:19Reshape a matrix into a column vector:A(:)Assign new elements without changing the shape of an array:A = rand(3,4);
A(:) = 1:12;Index a range of elements in a particular dimension:A(2:5,3)Index all elements in a particular dimension:A(:,3)for loop bounds:x = 1;
for k = 1:25
x = x + x^2;
end2 Program Components