MATLAB Object-Oriented Programming

(Joyce) #1

Custom Display Interface


In this section...
“Default Object Display” on page 18-2
“CustomDisplay Class” on page 18-3
“Methods for Customizing Object Display” on page 18-3

Default Object Display


MATLAB adds default methods named disp and display to all MATLAB classes that do
not implement their own methods with those names. These methods are not visible, but
create the default simple display.

The default simple display consists of the following parts:


  • A header showing the class name, and the dimensions for nonscalar arrays.

  • A list of all nonhidden public properties, shown in the order of definition in the class.


The actual display depends on whether the object is scalar or nonscalar. Also, there are
special displays for a scalar handle to a deleted object and empty object arrays. Objects in
all of these states are displayed differently if the objects have no properties.

The details function creates the default detailed display. The detailed display adds
these items to the simple display:


  • Use of fully qualified class names

  • Link to handle class, if the object is a handle

  • Links to methods, events, and superclasses functions executed on the object.


See “Class with Default Object Display” on page 18-14 for an example of how MATLAB
displays objects.

Properties Displayed by Default

MATLAB displays object properties that have public get access and are not hidden (see
“Property Attributes” on page 8-9). Inherited abstract properties are excluded from
display. When the object being displayed is scalar, any dynamic properties attached to the
object are also included.

18 Customizing Object Display

Free download pdf