Main Content

matlab.system.display.SectionGroup class

Package: matlab.system.display

Section group for System objects




matlab.system.display.SectionGroup(N1,V1,...Nn,Vn) creates a group for displaying System object™ properties and display sections created with matlab.system.display.Section. You define such sections or properties using property Name-Value pairs (N,V). A section group can contain both properties and sections. You use matlab.system.display.SectionGroup to define section groups using the getPropertyGroupsImpl method. Section groups display as separate tabs in the MATLAB System block. The available Section properties are:

  • Title — Group title. The default value is an empty character vector.

  • TitleSource — Source of group title. Valid values are 'Property' and 'Auto'. The default value is 'Property', which uses the character vector from the Title property. If the Obj name is given, the default value is Auto, which uses the Obj name. In the System object property display at the MATLAB® command line, you can omit the default "Main" title for the first group of properties by setting TitleSource to 'Auto'.

  • Description — Group or tab description that appears above any properties or panels. The default value is an empty character vector.

  • PropertyList — Group or tab property list as a cell array of property names. The default value is an empty array. If the Obj name is given, the default value is all eligible display properties.

  • Sections — Group sections as an array of section objects. If the Obj name is given, the default value is the default section for the Obj.

  • Type — Container type. For example, tab, group, panel, and collapsible panel.

  • Row— Specify the row in which the containers need to be placed (current/new). You can specify the row using the enum class matlab.system.display.internal.Row.

  • AlignPrompts— Specify a boolean value to control align prompts within the containers.

matlab.system.display.SectionGroup(Obj,...) creates a section group for the specified System object (Obj) and sets the following property values:

  • TitleSource — Set to 'Auto'.

  • Sections — Set to matlab.system.display.Section object for Obj.

You can use mfilename('class') from within this method to get the name of the System object. If you set any Name-Value pairs, those property values override the default settings.


collapse all

Define in your class definition file two tabs, each containing specific properties. For this example, you use the matlab.system.display.SectionGroup, matlab.system.display.Section, and getPropertyGroupsImpl methods.

classdef MultipleGroupsWithSectionGroup < matlab.System
    % MultipleGroupsWithTabs Customize block dialog with multiple tabs and parameter groups.
    % Public, tunable properties
        %StartValue Start Value
        StartValue = 0
        %EndValue End Value
        EndValue = 10
        Threshold = 1
        %BlockLimit Limit
        BlockLimit = 55
    % Public Nontunable 
        %IC1 First initial condition
        IC1 = 0
        %IC2 Second initial condition
        IC2 = 10
        %IC3 Third initial condition
        IC3 = 100

        %UseThreshold Use threshold
        UseThreshold (1,1) logical = true
    methods (Static, Access = protected)
        function groups = getPropertyGroupsImpl
            % Section to always display above any tabs.
            alwaysSection = matlab.system.display.Section(...
            % Group with no sections
            initTab = matlab.system.display.SectionGroup(...
                'Title','Initial conditions', ...
            % Section for the value parameters
            valueSection = matlab.system.display.Section(...
                'Title','Value parameters',...
                'SectionType', matlab.system.display.SectionType.collapsiblepanel);
            % Section for the threshold parameters
            thresholdSection = matlab.system.display.Section(...
                'Title','Threshold parameters',...
                'SectionType', matlab.system.display.SectionType.collapsiblepanel);
            % Group with two sections: the valueSection and thresholdSection sections
            mainTab = matlab.system.display.SectionGroup(...
                'Title','Main', ...
            % Return an array with the group-less section, the group with
            % two sections, and the group with no sections.
            groups = [alwaysSection,mainTab,initTab];

The resulting dialog appears as follows when you add the object to Simulink® with the MATLAB System block.