lookup
Approximate-match lookup in a vector or array.
Syntax
Section titled “Syntax”v = lookup(lookup_value, lookup_vector, result_vector)v = lookup(lookup_value, array)Description
Section titled “Description”Vector form: searches lookup_vector for the largest value ≤ lookup_value and returns the corresponding entry of result_vector. Both vectors must be sorted ascending.
Array form: searches the first row or column of array (depending on shape) and returns from the last row or column. Largely superseded by xlookup.
Example
Section titled “Example”lookup(4.5, [1 3 5 7 9], ['a' 'b' 'c' 'd' 'e']) % 'b'