Documentation Center

  • Trial Software
  • Product Updates

meta.MetaData class

Package: meta
Superclasses: matlab.mixin.Heterogeneous

Superclass for MATLAB object metadata

Description

The meta.MetaData class of objects represent MATLAB® class definitions and the constituent parts of those definitions, such as properties and methods. Metadata enable a program to get information about a class definition.

The meta.MetaData class forms the root of the metadata class hierarchy, which enables the formation of arrays of metadata objects belonging to different specific classes.

MATLAB uses instances of the meta.MetaData class as the default object to fill in missing array elements.

findobj and findprop, can search the metadata hierarchy and return an array of different metadata objects. These function require the ability to form heterogeneous arrays containing various metaclass objects.

See the matlab.mixin.Heterogeneous class for more information on heterogeneous hierarchies.

Construction

You cannot create an instance of the meta.MetaData class directly. MATLAB constructs instances of this class as required.

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB documentation.

Examples

This example shows how the meta.MetaData class facilitates working with metaclasses.

Create a meta.class instance representing the MATLAB timeseries class:

>> mc = ?timeseries;

MATLAB uses meta.MetaData objects to fill empty array elements:

>> m(2) = mc
>> class(m(1))

ans =

meta.MetaData
>> class(m(2))

ans =

meta.class

Use findobj to find all properties and methods that have protected access:

>> protectedMembers = findobj(mc,{'Access','protected'},...
'-or',{'SetAccess','protected'},...
'-or',{'GetAccess','protected'});

The timeseries class defines both properties and methods that have protected access. Therefore, findobj returns a heterogeneous array of class meta.MetaData. This array contains both meta.property and meta.method objects.

>> protectedMembers

protectedMembers = 

  11x1 heterogeneous meta.MetaData (meta.property, meta.method) 
  handle with no properties.
  Package: meta
>> class(protectedMembers(1))

ans =

meta.property

>> protectedMembers(1).Name

ans =

Length
>> protectedMembers(1).SetAccess

ans =

protected
>> protectedMembers(1).GetAccess

ans =

public

See Also

|

How To

Was this topic helpful?