|On this page…|
A MATLAB® class definition is a template whose purpose is to provide a description of all the elements that are common to all instances of the class. Class members are the properties, methods, and events that define the class.
MATLAB classes are defined in code blocks, with sub-blocks delineating the definitions of various class members. See classdef Syntax for details on the classdef block.
Attributes modify the behavior of classes and the members defined in the class-definition block. For example, you can specify that methods are static or that properties are abstract, and so on. The following sections describe these attributes:
Class definitions can provide information, such as inheritance relationships or the names of class members without actually constructing the class. See Class Metadata.
See Specifying Attributes for more on attribute syntax.
There are two kinds of MATLAB classes—handle and value classes.
Handle classes create objects that reference the data contained. Copies refer to the same data.
Value classes make copies of the data whenever the object is copied or passed to a function. MATLAB numeric types are value classes.
See Comparing Handle and Value Classes for a more complete discussion.
For information on class constructors, see Class Constructor Methods
For information on creating arrays of objects, see Creating Object Arrays
For more information on how to define class hierarchies, see Hierarchies of Classes — Concepts.