Matlab Syntax Reference & Class Components

April 18th, 2010 Posted in Documents

Building Blocks

The basic components in the class definition are blocks describing the whole class and specific aspects of its definition:

classdef block contains the class definition within a file that starts with the classdef keyword and terminates with the end keyword. See The Classdef Block for more information.

1
2
3
classdef ClassName
   ...
end

properties block (one for each unique set of attribute specifications) contains property definitions, including optional initial values. The properties block starts with the properties keyword and terminates with the end keyword. See for more syntax information.

1
2
3
4
5
6
classdef ClassName
   properties
      ...
   end
   ...
end

methods block (one for each unique set of attribute specifications) contains function definitions for the class methods. The methods block starts with the methods keyword and terminates with the end keyword. See The Methods Block for more syntax information.

1
2
3
4
5
6
classdef ClassName
   methods
      ...
   end
   ...
end

events block (one for each unique set of attribute specifications) contains the names of events that this class declares. The events blocks starts with the events keyword and terminates with the end keyword. See for more syntax information.

1
2
3
4
5
6
classdef ClassName
   events
      ...
   end
   ...
end

properties, methods, and events are keywords only within a classdef block.

More In Depth Information

Defining Classes — Syntax for more detail on class syntax.

for information on specifying properties.

Class Methods for information on specifying methods.

for information on the use of events.

for a list of all attributes.

Leave a Reply

You must be logged in to post a comment.