Property Class and Size Validation
In this section...
“Property Class and Size” on page 8-31
“Property Size Validation” on page 8-31
“Property Class Validation” on page 8-33
“Default Values Per Size and Class” on page 8-37
Property Class and Size
MATLAB applies any class and size validation defined for a property before calling
validation functions. Assignment to a property that defines size or class validation is
analogous to assignment to a MATLAB object array. MATLAB can apply class and size
conversions to the right side of the assignment to satisfy class and size validation.
For more information, see “Order of Validation” on page 8-27 and “Property Validation
Functions” on page 8-40.
Property Size Validation
Specify the property size as the row, column, and additional dimension following the
property name. Size validation does not support scientific notation.
classdef MyClass
properties
Prop(dim1,dim2,...) = defaultValue
end
end
Assignment and Size Validation
This class defines the size of the Location property as 1-by-3. Any value assigned to this
property must conform to that size or must be convertible to that size.
classdef ValidateProps
properties
Location(1,3)
end
end