Documentation Center

  • Trial Software
  • Product Updates


Largest element in array of fi objects


[y,v] = max(a)
[y,v] = max(a,[],dim)


  • For vectors, max(a) is the largest element in a.

  • For matrices, max(a) is a row vector containing the maximum element from each column.

  • For N-D arrays, max(a) operates along the first nonsingleton dimension.

max(a,b) returns an array the same size as a and b with the largest elements taken from a or b. Either one can be a scalar.

[y,v] = max(a) returns the indices of the maximum values in vector v. If the values along the first nonsingleton dimension contain more than one maximal element, the index of the first one is returned.

[y,v] = max(a,[],dim) operates along the dimension dim.

When complex, the magnitude max(abs(a)) is used, and the angle angle(a) is ignored. NaNs are ignored when computing the maximum.

See Also

| | |

Was this topic helpful?