%% Remainder of Two Arrays
% Create two 3-by-3 matrices, then use rem to find the remainder after dividing Y into X.

X = [1 2 3;4 5 6;7 8 9];
Y = [9 8 7;6 5 4;3 2 1];
R = rem(X,Y)

% Inputs X and Y must have the same dimensions unless one is a scalar double.
% Copyright 2012 The MathWorks, Inc.