To fill in the preceding array elements, MATLAB calls the class constructor to create a
single object. MATLAB copies this object to all the remaining array elements. Calling the
constructor to create the default object resulted in another call to the randi function,
which returns a new random number:A(1,1).RandNumbans =10MATLAB copies this second instance to all remaining array elements:A(2,2).RandNumbans =10A(2,3).RandNumbans =10When initializing an object array, MATLAB assigns a copy of a single object to the empty
elements in the array. MATLAB gives each object a unique handle so that later you can
assign different property values to each object. The objects are not equivalent:A(1,1) == A(2,2)ans =0That is, the handle A(1,1) does not refer to the same object as A(2,2). The creation of
an array with a statement such as:A(4,5) = InitHandleArray;results in two calls to the class constructor. The first creates the object for array element
A(4,5). The second creates a default object that MATLAB copies to all remaining empty
array elements.10 Object Arrays