subrange
Vector subrange extractor.
Syntax
subrange(base_vector, begin, end)
Argument
- base_vector
- A valid vector expression.
- begin
- A scalar specifying the minimum value of the subrange.
- end
- A scalar specifying the maximum value of the subrange.
Example
Templex Expression | Results |
---|---|
{subrange( {2, 5, 8, 12}, 4, 10)} |
1, 2 |
{subrange( {2, 5, 8, 12}, 0, 10)} |
0, 1, 2 |
{subrange( {2, 5, 8, 12}, 4, 15)} |
1, 2, 3 |
{subrange( {2, 5, 8, 12}, 0, 15)} |
0, 1, 2, 3 |
{(100:500:100[subrange
|
200, 300 |
Comments
The subrange function returns a vector containing the indices of the elements of base_vector that are greater than or equal to begin, but less than or equal to end.
If begin is less than the first element in base_vector, the index of the first element in base_vector is the first element in the resultant vector.
If end is greater than the last element in base_vector, the index of the last element in base_vector is the last element in the resultant vector.
The first element in a vector is located at index zero.