Main Content

Stateflow.SimulinkBasedState

Simulink based state in chart, state, or box

    Description

    Use Stateflow.SimulinkBasedState objects to create Simulink® subsystems within a Stateflow® state. With Simulink based states, you can model hybrid dynamic systems or systems that switch between periodic and continuous time dynamics. For more information, see Simulink Subsystems as States.

    expand all

    collapse all

    Since R2023a

    In a Simulink based state called Locked, modify the mapping for the output we.

    Open the model sf_clutch.slx.

    open_system("sf_clutch.slx")

    Access the Stateflow.SimulinkBasedState object for the Simulink based state Locked.

    subsystem = find(sfroot,"-isa","Stateflow.SimulinkBasedState",  ...
        Name="Locked");

    Check the mapping for Simulink based state output we.

    getMappingForSymbol(subsystem,"we").Name
    ans = 
    'we'
    

    Map the Simulink based state output we to chart output wv.

    setMappingForSymbol(subsystem,"we","wv")
    getMappingForSymbol(subsystem,"we").Name
    ans = 
    'wv'
    

    Clear the mapping for Simulink based state output we.

    clearMappingForSymbol(subsystem,"we")
    getMappingForSymbol(subsystem,"we").Name
    ans = 
    'we'
    
    Introduced in R2017b

    expand all