classdef
is a keyword used to define MATLAB classes.
classdef
ClassName
begins the class definition and an end
keyword terminates the classdef
block. Only blank lines and comments can precede classdef
. Enter a class definition in a file having the same name as the class, with a filename extension of .m
. Valid class names begin with an alphabetic character, and can contain letters, numbers, or underscores.
classdef ClassName
< SuperclassName1
& SuperclassName2
...
begins the class definition and specifies one or more superclasses. For more information on deriving classes from other classes, see Subclass Definition.
classdef (AttributeName1 = attributevalue, AttributeName2 = attributevalue, ...)
ClassName
begins the class definition and specifies optional class attributes. For a list of class attributes, see Class Attributes.
Class definition files can be in folders on the MATLAB path or in class folders whose parent folder is on the MATLAB path. Class folder names begin with the '@'
character followed by the class name (for example, @MyClass
). For more information on class folders, see Class Files and Folders .
For more information on classes, see Classdef Block and Class Definition.