FUNCTION REFERENCE
max
Largest element.
Largest element.
Syntax
[M,I] = max(A)Syntax
[M,I] = max(A,[],dim) or max(A,[],vecdim) or max(A,[],'all')Syntax
max(A,B) or max(A,B,nanflag)For 2-D and N-D arrays, max(A) reduces the first non-singleton dimension. Specify a dimension, a vector of dimensions or 'all' to choose which elements to compare. Append 'omitnan' (default) to ignore NaNs or 'includenan' to propagate them. I gives the first maximum's position within each reduced slice in column-major order. Append 'linear' to get indices into A. With two arrays, max compares corresponding elements. Complex values are ordered by magnitude, then phase angle.
Example
max([3 9 2]) % 9Example
[m,i] = max([NaN 1;4 3],[],2,'omitnan'); i % [2;1]Example
max(reshape(1:8,2,2,2),[],'all') % 8Differences from MATLAB: The 'ComparisonMethod' option is unsupported.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.