Inspect Class Instance
Create an EmployeeData object and determine property access settings:
EdObj = EmployeeData('My Name',1234567);
mcEdObj = metaclass(EdObj);
mpArray = mcEdObj.PropertyList;
EdObj.(mpArray(1).Name) % Dynamic field names work with objects
The value of the EmployeeName property is the text My Name, which was assigned in the
constructor.
ans =
My Name
The value of the EmployeeNumber property is not accessible because the property has
private Access.
EdObj.(mpArray(2).Name)
You cannot get the 'EmployeeNumber' property of EmployeeData.
mpArray(2).GetAccess
ans =
private
Obtain a function handle to the EmployeeName property set access function:
mpArray(1).SetMethod
ans =
@D:\MyDir\@EmployeeData\EmployeeData.m>EmployeeData.set.EmployeeName
Metaclass EnumeratedValues Property
The meta.class EnumeratedValues property contains an array of
meta.EnumeratedValue objects, one for each enumeration member. Use the
meta.EnumeratedValue Name property to obtain the enumeration member names
defined by an enumeration class. For example, given the WeekDays enumeration class:
classdef WeekDays
enumeration
Monday, Tuesday, Wednesday, Thursday, Friday
end
end
16 Information from Class Metadata