Main Content

matlab.system.display.SectionGroup class

Package: matlab.system.display
Superclasses:

Section group for System objects

Syntax

matlab.system.display.SectionGroup(N1,V1,...Nn,Vn)
matlab.system.display.SectionGroup(Obj,...)

Description

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 (Simulink) 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.

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

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.

Examples

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
    properties
        %StartValue Start Value
        StartValue = 0
        
        %EndValue End Value
        EndValue = 10
        
        Threshold = 1
        
        %BlockLimit Limit
        BlockLimit = 55
    end
    % Public Nontunable 
    properties(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
    end
    
    methods (Static, Access = protected)
        function groups = getPropertyGroupsImpl
            % Section to always display above any tabs.
            alwaysSection = matlab.system.display.Section(...
                'Title','','PropertyList',{'BlockLimit'});
           
            % Group with no sections
            initTab = matlab.system.display.SectionGroup(...
                'Title','Initial conditions', ...
                'PropertyList',{'IC1','IC2','IC3'},...
                'GroupType', matlab.system.display.SectionType.group);
            
            % Section for the value parameters
            valueSection = matlab.system.display.Section(...
                'Title','Value parameters',...
                'PropertyList',{'StartValue','EndValue'},...
                'SectionType', matlab.system.display.SectionType.collapsiblepanel);
            
            % Section for the threshold parameters
            thresholdSection = matlab.system.display.Section(...
                'Title','Threshold parameters',...
                'PropertyList',{'Threshold','UseThreshold'},...
                'SectionType', matlab.system.display.SectionType.collapsiblepanel);
            
            % Group with two sections: the valueSection and thresholdSection sections
            mainTab = matlab.system.display.SectionGroup(...
                'Title','Main', ...
                'Sections',[valueSection,thresholdSection],...
                'GroupType', matlab.system.display.SectionType.group);
            
            % Return an array with the group-less section, the group with
            % two sections, and the group with no sections.
            groups = [alwaysSection,mainTab,initTab];
        end
    end
end

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