Table Of Contents

max

Version:
    Last Modified: December 12, 2016

    Returns the largest input element.

    Syntax

    c = max(a)
    c = max(a, b)
    c = max(a, [], e)
    [c, d] = max(a)
    [c, d] = max(a, [], e)

    Inputs

    a

    Numeric scalar or numeric array of any dimension.

    b

    Numeric scalar or numeric array of the same size as a.

    e

    Dimension of a in which MathScript determines the largest input element. e can be in a range of 1 to the maximum supported array dimension (32). If you do not assign a value to b, MathScript uses the first dimension whose size is not equal to 1.. If you do not specify e, the function works with the first dimension whose size is not equal to 1.

    []

    Tells MathScript that you want to specify a and e but not b.

    Outputs

    c

    Largest element. c is the largest element along dimension e in a. If e is not specified, the function works on the first dimension whose size is not equal to 1. If you specify b, c returns the pair-wise maximum of a and b.

    d

    Indexes of the largest elements in a. d is the same size as c. If multiple maximum elements exist, d is the first index of the maximum elements.

    Complex Elements

    If the elements are complex, MathScript compares their magnitude first. If the magnitudes are equal, MathScript then compares the angles.

    A = rand(3, 3)
    C = max(A)

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: DAQExpress does not support FPGA devices


    Recently Viewed Topics