Class Introspection with Metadata
In this section...
“Using Class Metadata” on page 16-5
“Inspect the EmployeeData Class” on page 16-5
“Metaclass EnumeratedValues Property” on page 16-8
Using Class Metadata
Use class metadata to get information about classes and objects programmatically. For
example, you can determine attribute values for class members or get a list of events
defined by the class. For basic information about metadata, see “Class Metadata” on page
16-2.
Inspect the EmployeeData Class
The EmployeeData class is a handle class with two properties, one of which has private
Access and defines a set access method.
classdef EmployeeData < handle
properties
EmployeeName
end
properties (Access = private)
EmployeeNumber
end
methods
function obj = EmployeeData(name,ss)
if nargin > 0
obj.EmployeeName = name;
obj.EmployeeNumber = ss;
end
end
function set.EmployeeName(obj,name)
if ischar(name)
obj.EmployeeName = name;
else
error('Employee name must be a char vector')
end
end
Class Introspection with Metadata