Methods are the operations defined by a class. Methods can overload MATLAB® functions to perform the operations on objects of the class. MATLAB determines which method or function to call based on the dominant argument. Class constructor methods create objects of the class and must follow specific rules.
||Describe method of MATLAB class|
Different kinds of methods perform specific tasks in MATLAB classes.
Define methods in a
that specifies attributes for all methods defined in that block.
MATLAB uses the dominant argument to determine which method to call.
MATLAB dispatches to a specific method or function based on the dominant argument. There are rules that determine which argument is the dominant argument.
Define class methods in separate files for convenience and efficiency.
Method attributes control the behavior of methods.
Define ordinary methods within the class definition file using method blocks.
The class constructor is a special method that creates instances of the class.
Static methods do not require an object of the class as an input argument.
There is a specific syntax necessary to use a method of your class as a callback for MATLAB graphics objects.
By overloading MATLAB functions for your class, objects of the class can support MATLAB operations.
If you want to define a method that accepts a MATLAB graphics object as the first arguments, specify the relative precedence of your class with respect to the graphics class.
Add support for array-creation functions without overloading these functions in your class.
Enable the use of objects in conditional statements by defining relational operators for the class of the object.