%% Size Defined by Existing Array
% Create a matrix of uniformly distributed random integers between 1 and 10 with the same size as an existing array.

A = [3 2; -2 1];
sz = size(A);
X = randi(10,sz)

%
% It is a common pattern to combine the previous two lines of code into a single line:

X = randi(10,size(A));

% Copyright 2012 The MathWorks, Inc.