Main Content

clearMappingForSymbol

Clear mapping for symbol in atomic subchart or box

Description

example

clearMappingForSymbol(subchart,subchartSymbol) clears the mapping for the symbol subchartSymbol in the atomic subchart or box subchart. After you clear the mapping, the symbol in the atomic subchart or box maps to a main chart symbol with the same name. For more information, see Map Variables for Atomic Subcharts and Boxes.

example

clearMappingForSymbol(subchart,subchartSymbolName) clears the mapping for the symbol named subchartSymbolName.

Examples

collapse all

In an atomic subchart called A, modify the mapping for the subchart input u1.

Open the model sf_atomic_iodata_fixed.slx.

openExample('stateflow/AtomicSubchartInOutDataExample', ...
    SupportingFile="sf_atomic_iodata_fixed.slx")

Access the Stateflow.AtomicSubchart object for the atomic subchart A.

subchart = find(sfroot,"-isa","Stateflow.AtomicSubchart",Name="A");

Use the Subchart property to access the Stateflow.Data object for subchart input u1.

subchartSymbol = find(subchart.Subchart, ...
    "-isa","Stateflow.Data",Name="u1");

Use the Chart property to access the Stateflow.Data object for chart input u2.

chartSymbol = find(subchart.Chart, ...
    "-isa","Stateflow.Data",Name="u2");

Get the mapping for subchart input u1.

getMappingForSymbol(subchart,subchartSymbol).Name
ans =

    'u1'

Map subchart input u1 to chart input u2.

setMappingForSymbol(subchart,subchartSymbol,chartSymbol)
getMappingForSymbol(subchart,subchartSymbol).Name
ans =

    'u2'

Clear the mapping for subchart input u1.

clearMappingForSymbol(subchart,subchartSymbol)
getMappingForSymbol(subchart,subchartSymbol).Name
ans =

    'u1'

In an atomic subchart called A, modify the mapping for the subchart output y1.

Open the model sf_atomic_iodata_fixed.slx.

openExample('stateflow/AtomicSubchartInOutDataExample', ...
    SupportingFile="sf_atomic_iodata_fixed.slx")

Access the Stateflow.AtomicSubchart object for the atomic subchart A.

subchart = find(sfroot,"-isa","Stateflow.AtomicSubchart",Name="A");

Get the mapping for subchart output y1.

getMappingForSymbol(subchart,"y1").Name
ans =

    'y1'

Map subchart output y1 to chart output y2.

setMappingForSymbol(subchart,"y1","y2")
getMappingForSymbol(subchart,"y1").Name
ans =

    'y2'

Clear the mapping for subchart output y1.

clearMappingForSymbol(subchart,"y1")
getMappingForSymbol(subchart,"y1").Name
ans =

    'y1'

Input Arguments

collapse all

Atomic subchart or box, specified as a Stateflow.AtomicSubchart or Stateflow.AtomicBox object.

Symbol in atomic subchart or box, specified as a Stateflow.Data or Stateflow.Event object.

Name of symbol in atomic subchart or box, specified as a string scalar or character vector.

Version History

Introduced in R2022b