if nargin > 0
obj.Value = v;
end
end
end
endUsing the revised class definition, the previous array assignment statement executes
without error:a(1,7) = SimpleValue(7)a =1x7 SimpleValue array with properties:ValueThe object assigned to array element a(1,7) uses the input argument passed to the
constructor as the value assigned to the property:a(1,7)ans =
SimpleValue with properties:Value: 7MATLAB created the objects contained in elements a(1,1:6) with no input argument.
The default value for properties empty []. For example:a(1,1)ans =
SimpleValue with properties:Value: []MATLAB calls the SimpleValue constructor once and copies the returned object to each
element of the array.Initial Value of Object Properties
When MATLAB calls a constructor with no arguments to initialize an object array, one of
the following assignments occurs:10 Object Arrays