metaclass - Obtain matlab.metadata.Class object - MATLAB (original) (raw)

Main Content

Obtain matlab.metadata.Class object

Syntax

mc = metaclass(object) mc = ?_`ClassName`_

Description

mc = metaclass(object) returns thematlab.metadata.Class object for the class ofobject. The object input argument can be a scalar or an array of objects. However, metaclass always returns a scalar matlab.metadata.Class object.

mc = ?_`ClassName`_ returns thematlab.metadata.Class object for the class with name,ClassName. The ? operator works only with a class name, not an object.

If you pass a class name as a char vector to themetaclass function, it returns thematlab.metadata.Class object for the char class. Use the ? operator or the matlab.metadata.Class.fromName method to obtain thematlab.metadata.Class object from a class name. Use this method if you want to pass the class name in a char variable.

Examples

Return the matlab.metadata.Class object for an instance of theMException class:

obj = MException('Msg:ID','MsgTxt'); mc = metaclass(obj);

Use the ? operator to get the matlab.metadata.Class object for the matlab.mixin.SetGet class:

mc = ?matlab.mixin.SetGet;

Extended Capabilities

Thread-Based Environment

Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.