getPropertyGroupsImpl

Property groups for System object display

Syntax

group = getPropertyGroupsImpl

Description

group = getPropertyGroupsImpl specifies how to display properties in the block dialog of a MATLAB System block. You can specify:

  • Sections — Arrange properties into sections (panel on the MATLAB System block dialog) with matlab.system.display.Section.

  • Section Groups — Arrange properties and sections into groups (tabs on the MATLAB System block dialog) with matlab.system.display.SectionGroup.

  • Order of properties — Specify the order of properties within sections/groups

  • Order of sections — Specify the order of sections within groups.

If you create a section, but that section is not in a section group, its properties appear above the block dialog tab panels.

Run-Time Details

In Simulink®, getPropertyGroupsImpl modifies the MATLAB System block dialog.

In MATLAB®, getPropertyGroupsImpl modifies how properties appear when the System object™ is displayed at the MATLAB command line. getPropertyGroupsImpl defines the order and groupings of properties. If your getPropertyGroupsImpl defines multiple section groups, only properties from the first section group are displayed at the command line. To display properties in other sections, a link is provided at the end of a System object property display. Group titles are also displayed at the command line.

Method Authoring Tips

  • You must set Access = protected for this method.

  • If you include a getPropertyGroupsImpl method but do not list all properties, the excluded properties do not appear in the dialog box.

  • To omit the Main title for the first group of properties, in matlab.system.display.SectionGroup, set TitleSource to 'Auto'.

  • By default if you do not customize this method in your System object, the MATLAB System block dialog displays all public properties in the order specified in the System object class file.

  • To customize property names, add comments above each property. For an example, see System Object to Block Dialog Box Default Mapping.

Output Arguments

expand all

Property groups and sections to pass to the MATLAB System block, specified as an array of matlab.system.display.Section and matlab.system.display.SectionGroup objects.

Examples

expand all

This example customizes the block dialog box for a MATLAB System block by specifying property display names and modifying the getPropertyGroupImpl method. This customization is demonstrated with the System object AddPropertySections.

Change Property Labels

To change the property label that appears on the dialog box, add comments before each property in this format %PropertyName Block Dialog Label with no space between the percent sign and the property name. For example, to display the UseAlpha property as Use alpha, specify:

%UseAlpha Use alpha
UseAlpha = 0

The AddPropertySections System object included with this example relabels properties for display in the MATLAB System block dialog.

Organize Dialog Box

To organize the properties on the dialog box, the AddPropertySections System object class defines a getPropertyGroupsImpl method. Inside the getPropertyGroupsImpl method, this example defines two sections, each with two properties.

classdef AddPropertySections < matlab.System
    % AddPropertySections Customized dialog with two parameter sections
    
    % Public, tunable properties
    properties
        
        %NumberOfShapes Number of shapes
        NumberOfShapes = 10
        
        Alpha = 0.75
    end
 
    % Public, nontunable properties
    properties(Nontunable)
        Coloring (1, 1) {mustBeMember(Coloring,["red","blue","green"])} = "red"

        %UseAlpha Use alpha
        UseAlpha (1,1) logical = false
    end
    
    methods (Static, Access = protected)
        function groups = getPropertyGroupsImpl           
            % Section for the value parameters
            valueSection = matlab.system.display.Section(...
                'Title','Shape parameters',...
                'PropertyList',{'NumberOfShapes','Coloring'});
            
            % Section for the threshold parameters
            shadingSection = matlab.system.display.Section(...
                'Title','Shading parameters',...
                'PropertyList',{'UseAlpha','Alpha'});
            
            % Return an array with the two sections.
            groups = [valueSection, shadingSection];
        end
    end
end

Resulting Dialog Box

load_system('CustomSystemBlockDialog')
open_system('CustomSystemBlockDialog/MATLAB System')

This example customizes the block dialog box for the MultipleGroupsWithTabs MATLAB System block by specifying property display names and modifying the getPropertyGroupImpl method.

Change Property Label

To change the property label that appears on the dialog box, add comments before each property in this format %PropertyName Block Dialog Label with no space between the comment and the property name. For example, to display the StartValue property as Start Value, specify:

%StartValue Start Value
StartValue = 0

The MultipleGroupsWithTabs System object in this example relabels each property for display in the MATLAB System block dialog.

Organize Dialog Box

The MutlitpleGroupsWithTabs System object class defines a getPropertyGroupsImpl method. Inside the getPropertyGroupsImpl method, this example defines two tabs (section groups) and three parameter groupings (sections).

classdef MultipleGroupsWithTabs < 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'});
            
            % Section for the value parameters
            valueSection = matlab.system.display.Section(...
                'Title','Value parameters',...
                'PropertyList',{'StartValue','EndValue'});
            
            % Section for the threshold parameters
            thresholdSection = matlab.system.display.Section(...
                'Title','Threshold parameters',...
                'PropertyList',{'Threshold','UseThreshold'});
            
            % Group with two sections: the valueSection and thresholdSection sections
            mainTab = matlab.system.display.SectionGroup(...
                'Title','Main', ...
                'Sections',[valueSection,thresholdSection]);
            
            % 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

Resulting Dialog Box

load_system('ShowSystemBlockDialog')
open_system('ShowSystemBlockDialog/MATLAB System')

Introduced in R2013b