This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Class: matlab.mixin.CustomDisplay
Package: matlab.mixin

Build and return display header text


s = getHeader(obj)


s = getHeader(obj) returns the text used as the header when displaying obj. This method is called once for the entire object array.

Override this method to create a custom header. The overriding implementation must support all states of the object, including scalar, nonscalar, empty, and deleted (if obj is an instance of a handle class).

Input Arguments


Object array of a class derived from matlab.mixin.CustomDisplay

Output Arguments


Header string, returned as a char array

The default implementation returns the following:

  • If obj is scalar, returns classname, which is the simple name of the class (the nonpackage-qualified name).

  • If obj is nonscalar, returns classname and dimensions.

  • If obj is empty, returns an empty char.

  • If obj is a deleted handle, returns the string deleted classname handle

classname is linked to MATLAB® documentation for the class. Selecting the link displays the helpPopup window.

If you override this method, you might need to terminate s with a newline (\n) character.


expand all

Append the text, 'with Customized Display', to the header text.

Write a getHeader method.

methods (Access = protected)
   function header = getHeader(obj)
      if ~isscalar(obj)
         header = getHeader@matlab.mixin.CustomDisplay(obj);
         headerStr = matlab.mixin.CustomDisplay.getClassNameForHeader(obj);
         headerStr = [headerStr,' with Customized Display'];
         header = sprintf('%s\n',headerStr);

Add getHeader method to class definition.



To learn about attributes of methods, see Method Attributes.