%% Test Arrays for Equality
% Compare arrays using isequal rather than the == operator to test for equality, because == results in an error when the arrays are different sizes.
% Create two arrays.

A = ones(2,3);
B = rand(3,4,5);

%
% If size(A) and size(B) are the same, concatenate the arrays; otherwise, display a warning and return an empty array.

if isequal(size(A),size(B))
   C = [A; B];
else
   disp('A and B are not the same size.')
   C = [];
end

% Copyright 2015 The MathWorks, Inc.