Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

metaclass

Obtain meta.class object

Syntax

mc = metaclass(object)
mc = ?ClassName

Description

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

mc = ?ClassName returns the meta.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 the metaclass function, it returns the meta.class object for the char class. Use the ? operator or the meta.class.fromName method to obtain the meta.class object from a class name. Use this method if you want to pass the class name in a char variable.

Examples

Return the meta.class object for an instance of the MException class:

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

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

mc = ?matlab.mixin.SetGet;

Related Examples

Was this topic helpful?