Programming |
The display Method
MATLAB calls a method named display
whenever an object is the result of a statement that is not terminated by a semicolon. For example, creating the variable a
, which is a double, calls the MATLAB display
method for doubles.
You should define a display
method so MATLAB can display values on the command line when referencing objects from your class. In many classes, display
can simply print the variable name, and then use the char
converter method to print the contents or value of the variable, since MATLAB displays output as strings. You must define the char
method to convert the object's data to a character string.
Examples of display Methods
See the following sections for examples of display
methods:
Identifying Objects Outside the Class Directory | Accessing Object Data |
© 1994-2005 The MathWorks, Inc.