Main Content


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

Construct array of property groups


groups = getPropertyGroups(obj)


groups = getPropertyGroups(obj) returns an array of matlab.mixin.util.PropertyGroup objects. MATLAB® displays property groups separated by blank spaces.

Each default display state handler method calls this method once. The default implementation returns the properties in one group. These properties must have public GetAccess and not be defined as Hidden. If the object is scalar, MATLAB includes dynamic properties.

Override this method to construct one or more customized groups of properties to display.

Each group object array has the following fields:

  • Title — Text used as the header for the property group or an empty string if no title is used.

  • PropertyList — The property list can be either:

    • A 1-by-1 struct of property name-property value pairs

    • A cell array of property names.

Use the struct of name-value pairs if the object is scalar and you want to assign custom property values. Otherwise, use a cell array of property names. If the object is scalar MATLAB adds the property values retrieved from the object.

Input Arguments


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

Output Arguments


1xN array of matlab.mixin.util.PropertyGroup objects, where N is the number of groups


expand all

Customize the values returned by some properties.

Write a getPropertyGroups method.

methods (Access = protected)
   function propgrp = getPropertyGroups(obj)
      if ~isscalar(obj)
         propgrp = getPropertyGroups@matlab.mixin.CustomDisplay(obj);
         pd(1:length(obj.Password)) = '*';
         propList = struct('Department',obj.Department,...
            'Salary','Not available',...
         propgrp = matlab.mixin.util.PropertyGroup(propList);

Add function to class definition.



To learn about attributes of methods, see Method Attributes.