| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
Instances of the meta.class class contains information about MATLAB classes. The read/write properties of the meta.class class correspond to class attributes and are set only from within class definitions on the classdef line. You can query the read–only properties of the meta.class object to obtain information that is specified syntactically by the class (for example, to obtain the name of the class).
You cannot instantiate a meta.class object directly. You can construct a meta.class object from an instance of a class or using the class name:
metaclass — returns a meta.class object representing the object passed as an argument.
?classname — returns a meta.class object representing the named class.
fromName — static method returns a meta.class object representing the named class.
For example, the metaclass function returns the meta.class object representing myclass.
ob = myclass; obmeta = metaclass(ob); obmeta.Name ans = myclass
You can use the class name to obtain the meta.class object:
obmeta = ?myclass;
You can also use the fromName static method:
obmeta = meta.class.fromName('myclass');| Property | Purpose |
|---|---|
| ConstructOnLoad attribute, default = false | If true, the class constructor is called automatically when loading an object from a MAT-file. Therefore, the construction must be implemented so that calling it with no arguments does not produce an error. |
| ContainingPackage read only | A meta.package object describing the package within which this class is contained, or an empty object if this class is not in a package. |
| Description read only | Currently not used |
| DetailedDescription read only | Currently not used |
| Events read only | A cell array of meta.event objects describing each event defined by this class, including all inherited events. |
| Hidden attribute, default = false | If set to true, the class does not appear in the output of MATLAB commands or tools that display class names. |
| InferiorClasses attribute, default = {} | A cell array of meta.class objects defining the precedence of classes represented by the list as inferior to this class. |
| Methods read only | A cell array of meta.method objects describing each method defined by this class, including all inherited public and protected methods. See Class Methods. |
| Name read only | Name of the class associated with this meta.class object (char array) |
| Properties read only | A cell array of meta.property objects describing each property defined by this class, including all inherited public and protected properties. |
| Sealed attribute, default = false | If true, the class can be not be specialized with subclasses. |
| SuperClasses read only | A cell array of meta.class objects describing each superclass from which this class is derived. |
| Method | Purpose |
|---|---|
| fromName | Returns the meta.class object associated with the specified class name. |
| tf = eq(cls) | Equality function (a == b). Use to test if two variables refer to equal classed (classes that contain exactly the same list of elements). |
| tf = ne(cls) | Not equal function (a ~= b). Use to test if two variables refer to different meta–classes. |
| tf = lt(clsa,clsb) | Less than function (clsa < clsb). Use to determine if clsa is a strict subclass of clsb (i.e., clsb < clsb is false). |
| tf = le(clsa,clsb) | Less than or equal to function (clsa <= clsb). Use to determine if clsa is a subclass of clsb. |
| tf = gt(clsa,clsb) | Greater than function (clsb > clsa). Use to determine if clsb is a strict superclass of clsa (i.e., clsb > clsb is false). |
| tf = ge(clsa,clsb) | Greater than or equal to function (clsb >= clsa). Use to determine if clsb is a superclass of clsa. |
See Obtaining Information About Classes with Meta-Classes, fromName, meta.property, meta.method, meta.event, meta.package
![]() | meshgrid | meta.class.fromName | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |