properties
Date
Department
ProjectNumber
end
methods (Access = private)
function obj = MyProject
obj.Date = datestr(clock);
obj.Department = 'Engineering';
obj.ProjectNumber = 'P29.367';
end
end
end
Reference property data via the Constant property:
MyProject.ProjectInfo.Date
ans =
18-Apr-2002 09:56:59
Because MyProject is a handle class, you can get the handle to the instance that is
assigned to the constant property:
p = MyProject.ProjectInfo;
Access the data in the MyProject class using this handle:
p.Department
ans =
Engineering
Modify the nonconstant properties of the MyProject class using this handle:
p.Department = 'Quality Assurance';
p is a handle to the instance of MyProject that is assigned to the ProjectInfo constant
property:
MyProject.ProjectInfo.Department
Define Class Properties with Constant Values