getval2

Returns the value of a vector at the same index of a specified value in a corresponding vector.

Syntax

getval2(index_vec, data_vec, value)

Argument

index_vec
The vector to be indexed.
data_vec
The vector to be searched.
value
The value to be searched for in index_vec.

Example

Templex Expression Result
getval2({1,2,3,4,5},

{4,5,6,7,8},2) =

5

Comments

If the value occurs multiple times in index_vec, the first instance will always be the one found.

getval2({1,2,3,2}, {4,5,6,7}, 2) = 5

If the value occurs in index_vec at a location beyond the length of data_vec,an error occurs.

getval2({1,2,3,4,5},{6,7,8},4) = ERROR

If the value does not occur in index_vec, an error occurs.

getval2({1,2,3,4,5},{6,7,8,9,10}, 6) = ERROR