Main Content

matlab.system.display.SectionGroup クラス

パッケージ: matlab.system.display
スーパークラス:

System object のセクション グループ

構文

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

説明

matlab.system.display.SectionGroup(N1,V1,...Nn,Vn) は、matlab.system.display.Section によって作成された System object™ プロパティを表示するグループと表示セクションを作成します。プロパティの名前と値のペア (N,V) を使って、このようなセクションまたはプロパティを定義します。セクション グループには、プロパティとセクションの両方を含めることができます。getPropertyGroupsImpl メソッドを使ってセクション グループを定義するには、matlab.system.display.SectionGroup を使用します。セクション グループは、MATLAB System ブロック内の個別のタブとして表示されます。使用可能なセクション プロパティは次のとおりです。

  • Title — グループ タイトル。既定値は空の文字ベクトルです。

  • TitleSource — グループ タイトルのソース。有効な値は 'Property' および 'Auto' です。既定値は 'Property' です。この値は、Title プロパティからの文字ベクトルを使用します。Obj という名前を指定した場合、既定値は Auto で、Obj の名前を使用します。MATLAB® コマンド ラインの System object プロパティ表示では、TitleSource'Auto' に設定することで、プロパティの最初のグループの既定の "メイン" タイトルを省略できます。

  • Description — 任意のプロパティまたはパネルの上に表示されるグループまたはタブの説明。既定値は空の文字ベクトルです。

  • PropertyList — プロパティ名の cell 配列としてのグループまたはタブ プロパティ リスト。既定値は空の配列です。Obj 名を指定した場合、既定値はすべての有効な表示プロパティです。

  • Sections — セクション オブジェクトの配列としてのグループ セクション。Obj という名前を指定した場合、既定値は Obj の既定セクションです。

  • Type — コンテナーのタイプ。たとえば、タブ、グループ、パネル、および折りたたみ可能なパネル。

  • Row — コンテナーを配置する必要がある行を指定します (現在/新規)。行は enum クラス matlab.system.display.internal.Row を使用して指定できます。

  • AlignPrompts — コンテナー内のプロンプトの整列を制御するブール値を指定します。

matlab.system.display.SectionGroup(Obj,...) は、指定された System object (Obj) のセクション グループを作成し、次のプロパティ値を設定します。

  • TitleSource'Auto' に設定します。

  • SectionsObjmatlab.system.display.Section オブジェクトに設定します。

このメソッド内から mfilename('class') を使用して System object の名前を取得することができます。任意の名前と値のペアを設定した場合、そのプロパティ値は既定の設定をオーバーライドします。

すべて折りたたむ

クラス定義ファイルで、それぞれが特定のプロパティを含む 2 つのタブを定義します。この例では、matlab.system.display.SectiongetPropertyGroupsImpl および matlab.system.display.SectionGroup メソッドを使用します。

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

MATLAB System ブロックをもつ Simulink® にオブジェクトを追加すると、生成されるダイアログは次のようになります。