Attribute Values
When you specify attribute values, those values affect all the components defined within
the defining block. For example, the following property definition blocks set the:
- AccountBalance property SetObservable attribute to true
- SSNumber and CreditCardNumber properties' Hidden attribute to true and
SetAccess attribute to private.
Defining properties with different attribute settings requires multiple properties
blocks.
properties (SetObservable = true)
AccountBalance
end
properties (SetAccess = private, Hidden = true)
SSNumber
CreditCardNumber
end
Specified multiple attributes in a comma-separated list, as shown in the previous
example.
When specifying class attributes, place the attribute list directly after the classdef
keyword:
classdef (AttributeName = attributeValue) ClassName
...
end
Simpler Syntax for true/false Attributes
You can use a simpler syntax for attributes whose values are true or false — the
attribute name alone implies true and adding the not operator (~) to the name implies
false. For example:
methods (Static)
...
end
Is the same as:
methods (Static = true)
...
end