Table Of Contents

rem

Version:
    Last Modified: January 9, 2017

    Computes the remainder of the input elements.

    Syntax

    c = rem(a, b)

    Inputs

    a

    Dividend. a is a non-complex scalar or array of any dimension. If b is an array, a can be a scalar.

    b

    Divisor. b is a non-complex scalar or non-complex array of the same dimension as a. If a is an array, b can be a scalar.

    Outputs

    c

    Remainder of a divided by b. c has the same sign as a. c is an array of the same as the larger of a and b. The output data type is the smaller data type of the two inputs. For example, if one input is double precision and the other input is single precision floating point number, the output is a single precision floating point number.

    Calculation Formula

    The remainder is computed using the following equation: rem(a, b) = a-fix(a./b).*b.

    Input Types

    If the input elements have the same sign, rem(a, b) is equivalent to mod(a, b). If one input is an integer type, the other must be the same integer type or a double scalar type.

    A = [1:1:5]
    B = 3
    C = rem(A, B)

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: Not supported


    Recently Viewed Topics