Main Content

matlab.system.display.SectionGroup Class

Namespace: matlab.system.display

Create nested groupings of properties in Block Parameters dialog box for MATLAB System block

Description

Use the matlab.system.display.SectionGroup class inside the getPropertyGroupsImpl method to group custom elements you create for the Block Parameters dialog box of a MATLAB System (Simulink) block. A section group can contain sections created using the matlab.system.display.Section class, groups of System object™ properties, and custom buttons you create using the matlab.system.display.Action class.

By using section groups along with sections, you can create nested groups of properties within the dialog box. For example, the section group can implement a tab in the Block Parameters dialog box while one or more sections can create collapsible panels within that tab.

Class Attributes

Sealed
true

For information on class attributes, see Class Attributes.

Creation

Description

sectGrp = matlab.system.display.SectionGroup(Name,Value) creates a section group with properties defined using one or more name-value arguments.

example

sectGrp = matlab.system.display.SectionGroup(sysObj) creates a section group with properties defined based on the System object sysObj.

sectGrp = matlab.system.display.SectionGroup(sysObj,Name,Value) creates a section group with properties defined based on the System object sysObj and one or more name-value arguments. Values you specify using name-value arguments override the values set based on the System object.

Input Arguments

expand all

System object for MATLAB System block, specified as a System object.

When you specify the System object as an input argument, these property values for the property group come from the System object:

  • Title — System object name

  • PropertyList — All public properties of the System object

    You can specify this argument as mfilename("class").

Properties

expand all

Property group title, specified as a string or a character vector. By default, the title for the section in the Block Parameters dialog box is an empty character vector ('').

Example: "My Property Group"

Attributes:

GetAccess
public
SetAccess
public

Data Types: string | char

Source for property group title, specified as one of these options:

  • 'Property' — Section title comes from Title property for property group.

  • 'Auto' — Section title comes from System object specified as input argument for constructor.

Attributes:

GetAccess
public
SetAccess
public

Data Types: string | char

Property group description, specified as a string or a character vector. By default, the description is an empty character vector ('').

The description appears in the Block Parameters dialog box above any properties or sections.

Example: "My section group description."

Attributes:

GetAccess
public
SetAccess
public

Data Types: string | char

Properties available to set within top level of section group, specified as a cell array of character vectors that each define the name of a property. By default, the property list is an empty cell array ({}).

When you specify a System object as an input argument for the constructor, the property list is set to all public properties on the System object unless you override the setting by also specifying the property list as a name-value argument.

These types of properties are not available for display in the Block Parameters dialog box or in the summary that appears in the MATLAB® Command Window:

  • Hidden properties

  • Abstract properties

  • Private properties

  • Properties with protected access

  • Discrete states

  • Continuous states

You cannot display dependent properties in the Block Parameters dialog box but these properties do show in the System object summary you view in the MATLAB Command Window.

Example: {'Property1' 'Property2'}

Attributes:

GetAccess
public
SetAccess
public

Data Types: cell

Sections included in section group, specified as one or more instances of the matlab.system.display.Section class.

Attributes:

GetAccess
public
SetAccess
public

Data Types: matlab.system.display.Section

Type of section for section group, specified as a member of the matlab.system.display.SectionType enumeration class.

  • matlab.system.display.SectionType.tab — Creates a tab for the section group within the Block Parameters dialog box.

  • matlab.system.display.SectionType.panel — Creates a panel for the section group within the Block Parameters dialog box.

  • matlab.system.display.SectionType.group — Creates a titled group for the section group within the Block Parameters dialog box.

  • matlab.system.display.SectionType.collapsiblepanel — Creates a collapsible panel for the section group within the Block Parameters dialog box.

Attributes:

GetAccess
public
SetAccess
public

Data Types: matlab.system.display.SectionType

Option to control align prompts within containers, specified as logical true (1) or logical false (0).

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Examples

collapse all

In the class definition file for the System object, define two tabs in the Block Parameters dialog box for the MATLAB System block using the getPropertyGroupsImpl method. Each tab provides access to set different property values.

classdef MultipleGroupsWithSectionGroup < matlab.System

    properties
        StartValue = 0
        EndValue = 10
        Threshold = 1
        BlockLimit = 55
    end

    properties(Nontunable)
        IC1 = 0
        IC2 = 10
        IC3 = 100
        UseThreshold (1,1) logical = true
    end
    
    methods (Static, Access = protected)
        function groups = getPropertyGroupsImpl
            alwaysSection = matlab.system.display.Section(...
                'Title','','PropertyList',{'BlockLimit'});
           
            initTab = matlab.system.display.SectionGroup(...
                'Title','Initial conditions', ...
                'PropertyList',{'IC1','IC2','IC3'},...
                'GroupType', matlab.system.display.SectionType.group);
            
            valueSection = matlab.system.display.Section(...
                'Title','Value parameters',...
                'PropertyList',{'StartValue','EndValue'},...
                'SectionType',...
                matlab.system.display.SectionType.collapsiblepanel);
            
            thresholdSection = matlab.system.display.Section(...
                'Title','Threshold parameters',...
                'PropertyList',{'Threshold','UseThreshold'},...
                'SectionType',...
                matlab.system.display.SectionType.collapsiblepanel);
            
            mainTab = matlab.system.display.SectionGroup(...
                'Title','Main', ...
                'Sections',[valueSection thresholdSection],...
                'GroupType',matlab.system.display.SectionType.group);
            
            groups = [alwaysSection mainTab initTab];
        end
    end
end

When you add the object to the MATLAB System (Simulink) block, the Block Parameters dialog box for the block includes:

  • The header, at the top

  • The section for the limit parameter

  • The main section group that contains collapsible panels for the value and threshold parameters

  • The initial conditions section at the bottom

.

The Block Parameters dialog box for the MATLAB System block for the System object that contains the example code has the Value parameters collapsible panel expanded and the Threshold parameters collapsible panel collapsed. The Value parameters section includes text fields to set the Start Value and End Value parameters.

The Block Parameters dialog box for the MATLAB System block for the System object that contains the example code has the Value parameters panel collapsed and the Threshold parameters panel expanded. The Threshold parameters section includes a text field to set the Threshold parameter and a check box to set the Use threshold parameter.

Version History

Introduced in R2013b