| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
R = rem(X,Y)
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. The inputs X and Y must be real arrays of the same size, or real scalars.
The following are true by convention:
rem(X,0) is NaN
rem(X,X) for X~=0 is 0
rem(X,Y) for X~=Y and Y~=0 has the same sign as X.
mod(X,Y) for X~=Y and Y~=0 has the same sign as Y.
rem(X,Y) and mod(X,Y) are equal if X and Y have the same sign, but differ by Y if X and Y have different signs.
The rem function returns a result that is between 0 and sign(X)*abs(Y). If Y is zero, rem returns NaN.
![]() | relationaloperators (handle) | remove (Map) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |