Main Content

Simulink.SubsystemReference.getAllInstances

Return all Subsystem Reference blocks in model

Since R2022a

    Description

    ssRefBlocks = Simulink.SubsystemReference.getAllInstances(mdl) returns all Subsystem Reference blocks in a model.

    example

    Examples

    collapse all

    Load the model slexModelUsingReusableSS where you have to identify Subsystem Reference blocks.

    model = "slexModelUsingReusableSS";
    load_system(model);

    Get the paths of all Subsystem Reference blocks in the model.

    allInstances... 
        = Simulink.SubsystemReference.getAllInstances(model)
    allInstances = 3x1 cell
        {'slexModelUsingReusableSS/Int8 Input'  }
        {'slexModelUsingReusableSS/Int32 Input' }
        {'slexModelUsingReusableSS/Double Input'}
    
    

    Input Arguments

    collapse all

    Path or handle of a model, specified as a string scalar or character vector.

    Example: "slexModelUsingReusableSS"

    Data Types: string | char

    Output Arguments

    collapse all

    Paths or handles of Subsystem Reference blocks in a model, returned as a cell array of character vectors. The type of output depends on the input type. If you specify the path of model, the function returns the paths of the Subsystem Reference blocks.

    Version History

    Introduced in R2022a