Skip to content

maxel

Maximum element of an array.

v = maxel(A)
v = maxel(A, absolute)

Returns the largest element in A. With absolute = true, compares |A(i)| and returns the element with the largest absolute value (preserving its sign). For complex A, the magnitude is used.

Kernel-level companion to max. User-facing code should call max(A) instead.

maxel([3 -7 2 -1]) % 3
maxel([3 -7 2 -1], true) % -7 (largest |x|)
  • max — Maximum value along a dimension, or elementwise maximum of two inputs.
  • minel — Minimum element of an array.