| MATLAB Function Reference | ![]() |
classdef
properties
methods
events
classdef begins the class definition, which is terminated by an end key word. Only blank lines and comments can precede classdef. You must place a class definition in a file having the same name as the class, with a filename extension of .m.
See Defining Classes — Syntax for more information on classes.
properties begins a property definition block, which is terminated by an end key word. Class definitions can contain multiple property definition blocks, each specifying different attribute settings that apply to the properties in that particular block.
See Defining Properties for more information.
methods begins a methods definition block, which is terminated by an end key word. This block contains functions that implement class methods. Class definitions can contain multiple method blocks, each specifying different attribute settings that apply to the methods in that particular block. It is possible for method functions to be defined in separate files.
See Class Methods for more information.
events begins an events definition block, which is terminated by an end key word. This block contains event names defined by the class. Class definitions can contain multiple event blocks, each specifying different attribute settings that apply to the events in that particular block.
See Defining Events and Listeners — Syntax and Techniques for more information.
Display the attributes of all class component in a popup window, click this link: Attribute Tables
Here is the basic structure of a class definition.
classdef class_name properties PropertyName end methods function obj = methodName(obj,arg2,...) ... end end events EventName end end
MATLAB® Classes and Object-Oriented Programming
![]() | class | clc | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |