Describe method of MATLAB class
The meta.method
class provides information
about the methods of MATLAB® classes. The read/write properties
of the meta.method
class correspond to method attributes
and are specified only from within class definitions.
You can query the read-only properties of the meta.method
object
to obtain information that is specified syntactically by the class
(for example, to obtain the name of the class defining a method).
You cannot instantiate a meta.method
object
directly. Obtain a meta.method
object from the meta.class
MethodList
property,
which contains an array of meta.method
objects,
one for each class method. For example, replace ClassName
with
the name of the class whose methods you want to query:
mco = ?ClassName;
mlist = mco.MethodList;
mlist(1).Name; % name of first method in the list
Use the metaclass
function
to obtain a meta.class
object from a class instance:
mco = metaclass(obj);
Property | Purpose |
---|---|
Abstract | If
|
Access attribute, default = public | Determines what code can call this method.
|
DefiningClass | The meta.class object representing the class
that defines this method. |
Description read only | Currently not used |
DetailedDescription read only | Currently not used |
| When |
Name read only | Name of the method. |
Sealed attribute, default = false | If true , the method cannot be redefined
in a subclass. Attempting to define a method with the same name in
a subclass causes an error. |
Static attribute, default = false | Set to classname.methodname() Or with an instance of the class, like any method: o.methodname() See Static Methods |