MATLAB Function Reference    
rem

Remainder after division

Syntax

Description

R = rem(X,Y) if Y ~= 0, returns X - n.*Y where n = fix(X./Y). If Y is not an integer and the quotient X./Y is within roundoff error of an integer, then n is that integer. By convention, rem(X,0) is NaN. The inputs X and Y must be real arrays of the same size, or real scalars.

Remarks

So long as operands X and Y are of the same sign, the statement rem(X,Y) returns the same result as does mod(X,Y). However, for positive X and Y,

The rem function returns a result that is between 0 and sign(X)*abs(Y). If Y is zero, rem returns NaN.

See Also

mod


  release (COM) repmat