La traducción de esta página está obsoleta. Haga clic aquí para ver la última versión en inglés.
Métodos
Sintaxis, atributos y propósito de los métodos
Los métodos son las operaciones que define una clase. Los métodos pueden sobrecargar las funciones de MATLAB® para realizar las operaciones con objetos de la clase. MATLAB determinará a qué método o función llamar sobre la base del argumento dominante. Los métodos constructores de clases crean objetos de la clase y deben seguir reglas específicas.
Clases
meta.method | Describe MATLAB class method |
Temas
Uso de métodos
- Methods in Class Design
Different kinds of methods perform specific tasks in MATLAB classes. - Define Class Methods and Functions
Define methods in amethods
block that specifies attributes for all methods defined in that block. - Method Invocation
MATLAB uses the dominant argument to determine which method to call. - Method Access List
Specify a list of classes that can access a class method. - Object Precedence in Method Invocation
MATLAB dispatches to a specific method or function based on the dominant argument. There are rules that determine which argument is the dominant argument. - Methods in Separate Files
Define class methods in separate files for convenience and efficiency.
Tipos de métodos
- Method Attributes
Method attributes control the behavior of methods. - Ordinary Methods
Define ordinary methods within the class definition file using method blocks. - Class Constructor Methods
The class constructor is a special method that creates instances of the class. - Static Methods
Static methods do not require an object of the class as an input argument. - Class Methods for Graphics Callbacks
There is a specific syntax necessary to use a method of your class as a callback for MATLAB graphics objects.
Métodos que sobrecargan funciones
- Overload Functions in Class Definitions
By overloading MATLAB functions for your class, objects of the class can support MATLAB operations. - Dominant Argument in Overloaded Graphics Functions
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. - Class Support for Array-Creation Functions
Add support for array-creation functions without overloading these functions in your class. - Objects In Conditional Statements
Enable the use of objects in conditional statements by defining relational operators for the class of the object.