Enumerations for Property Values
In this section...
“Syntax for Property/Enumeration Definition” on page 14-17
“Example of Restricted Property” on page 14-17Syntax for Property/Enumeration Definition
You can restrict the values that are allowed for a property to members of an enumeration
class. Define the property as restricted to a specific enumeration class in the class
definition using this syntax:properties
PropName EnumerationClass
endThis syntax restricts values of PropName to members of the enumeration class
EnumerationClass.Example of Restricted Property
For example, the Days class defines a property named Today. The allowed values for the
Today property are enumeration members of the WeekDays class.The WeekDays class defines the enumerations:classdef WeekDays
enumeration
Monday, Tuesday, Wednesday, Thursday, Friday
end
endUse the WeekDays enumerations to restrict the allowed values of the Today property:classdef Days
properties
Today WeekDays
end
endCreate an object of the Days class.Enumerations for Property Values