max
Returns the maximum value of matrix.
Syntax
R = max(x)
R = max(x, [], dim)
[R,idx] = max(...)
R = max(x, y)
Inputs
- x
 - The matrix to query.
 - y
 - The second matrix for a pairwise query with x.
 - dim
 - The dimension on which to search.
 
Outputs
- R
 - The maximum value.
 - IDX
 - Index of max value.
 
Examples
Vector input with two outputs:
[a,b] = max([1,7,5])
      a = 7
b = 2
      Matrix input:
R = max([1,6;2,7])
      R = [Matrix] 1 x 2
2 7
      Matrix input with dimension:
R = max([1,6;2,5],[],1)
      R = [Matrix] 1 x 2
2 6
      Two matrix inputs:
R = max([1,6;2,5],[1,2;3,4])
      R = [Matrix] 2 x 2
1  6
3  5
    Comments
For a vector input, it returns the maximum element. For a matrix input, it returns the maximum element from each vector in the direction of interest. If two outputs are requested, it returns a matrix containing the maximum from each element pair.