PPT Slide
Creating Arrays (colon)
The colon can be used to generate a sequence of values. Forms:
lowValue : highValue
lowValue : step : highValue
Examples:
1 : 10
1 : 2 : 10
1 : 0.5 : 10
10 : –1 : 1
0 : 0.01 : 0.5
A sequence of values is an array value.
a = 0 : 2 : 16
b = [1 : 6] / 3
A sequence of integers can also be used to select a segment of an array.
a(3:6)
Previous slide
Next slide
Back to first slide
View graphic version