MATLAB class definitions comprise code blocks that define properties, methods, and events. Each block can declare attributes that apply to all properties, methods, or events defined in that particular block. Attributes also can apply to the class itself.
Define class components in code blocks that apply attributes to all class members in that block.
Organize classes in path folders or distribute the class definition among multiple files in a class @ folder.
classdef block contains the
class definition including all class member blocks.
Define properties in a
that specifies the property name, and optional type, default value,
Define methods in a
that specifies attributes for all methods defined in that block.
Specify attributes in the
events block. Attributes apply to all members
defined in that block.
Define event names in an
Only handle classes support events.
This example of a MATLAB class definition shows syntax and programming techniques used in typical classes.