Skip to content

match

Position of a value in a vector.

v = match(lookup_value, lookup_array, match_type)

Returns the position (1-based) of lookup_value in lookup_array.

  • match_type = 1 (default) — largest entry ≤ lookup_value (array must be ascending)
  • match_type = 0 — exact match
  • match_type = -1 — smallest entry ≥ lookup_value (array must be descending)
match('c', {'a','b','c','d'}, 0) % 3
  • xmatch — Modern match with full search-mode controls.
  • lookup — Approximate-match lookup in a vector or array.
  • index — Element of an array by row and column position.