Main Content

Simulink.SubsystemReference.getActiveInstances

Return active instances of subsystem reference

Since R2022a

    Description

    ssRefBlocks = Simulink.SubsystemReference.getActiveInstances(ssRef) returns all instances of a subsystem file that are currently active or loaded into memory.

    example

    Examples

    collapse all

    Load the subsystem file slexReusableSS and the model where you have to identify the active instances of the subsystem file.

    load_system(["slexReusableSS","slexModelUsingReusableSS"]);

    Get the paths of all the active instances of the subsystem file in the model.

    Simulink.SubsystemReference.getActiveInstances("slexReusableSS")
    ans = 4x1 cell
        {'slexReusableSS'                       }
        {'slexModelUsingReusableSS/Int32 Input' }
        {'slexModelUsingReusableSS/Int8 Input'  }
        {'slexModelUsingReusableSS/Double Input'}
    
    

    Input Arguments

    collapse all

    Path or handle of a subsystem file or a Subsystem Reference block instance in a model, specified as a string scalar or character vector.

    Example: "slexReusableSS"

    Example: "slexModelUsingReusableSS/Double Input"

    Output Arguments

    collapse all

    Paths or handles of the active instances of a subsystem file, returned as a cell array of character vectors. The type of output depends on the input type. If you specify the path of subsystem file, the function returns the paths of the active instances.

    Version History

    Introduced in R2022a