Difference between revisions of "MATLAB 2009a Class Method Attributes"

From ControlTheoryPro.com

Jump to: navigation, search
(Table of Class Method Attributes<ref>Method Attributes</ref>)
m (1 revision)
(No difference)

Latest revision as of 11:12, 18 April 2013

MATLAB 2009a Class Method Attributes
Green carrot left.gif
Classdef Event Properties
Green carrot.jpg
In order to prevent spam, users must register before they can edit or create articles.

1 Introduction to MATLAB 2009a Class Method Attributes

Classes in MATLAB 2009a can have several methods. After the classdef command line you must define your class properties. Once your properties are defined you define your methods. All available attributes are listed in the methods table.

Note that the first method you define should be the instantiation method (has the same name as the class).

1.1 Example Method Definitions

Most methods will be declared simply like this:

 classdef ...
   % Public

All method types are detailed in the next section.

See the psdData Class Example for more information.

2 Table of Class Method Attributes[1]

Attribute Name




logical Default=false

If true, the method has no implementation.

The method has a syntax line that can include arguments, which subclasses

use when implementing the method:

  • Subclasses are not required to define the same number

    of input and output arguments. However, subclasses generally use the

    same signature when implementing their version of the method.

  • The method can have comments after the function line.

  • The method does not contain function or end keywords, only the function syntax (e.g., [a,b] = myMethod(x,y))



Default = public

Determines what code can call this method:

  • public — Unrestricted access

  • protected — Access from methods in class or subclasses

  • private — Access by class methods only (not from subclasses)


logical Default=false

When false, the method name shows in the

list of methods displayed using the methods or methodsview commands. If set to true, the method name is not included

in these listings.

logical Default=false

If true, the method cannot be redefined

in a subclass. Attempting to define a method with the same name in

a subclass causes an error.


logical Default=false

Set to true to define a method that

is not depend on an object of the class and does not require an object

argument. You must use the class name to call the method: classname.methodname

3 References

MATLAB 2009a Help

3.1 Notes

  1. Method Attributes

4 MATLAB Related Books