www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/RemAfterDivisionForPositiveAndNegativeValuesExample.m

    %% Remainder After Division for Positive and Negative Values
% Find the remainder after division for a set of integers including both
% positive and negative values. Note that nonzero results have the same
% sign as the dividend.
a = [-4 -1 7 9];
b = 3;
r = rem(a,b)