Main Content

Simulink.SubsystemReference.getAllDirtyInstances

Return subsystem files referenced in model that are currently being edited

Since R2022a

    Description

    ssFiles = Simulink.SubsystemReference.getAllDirtyInstances(mdl) returns the subsystem files referenced in the model mdl that are currently being edited.

    example

    Examples

    collapse all

    The model slexModelUsingReusableSS uses three instances of the subsystem file slexReusableSS named Double Input, Int32 Input, and Int8 Input.

    model = "slexModelUsingReusableSS";
    open_system(model);

    Identify the subsystem files the model refers to that are currently being edited.

    Simulink.SubsystemReference.getAllDirtyInstances(model)
    ans =
    
      0x1 empty double column vector
    

    None of the instances or the subsystem file are currently being edited.

    Add a Scope block to the subsystem reference instance Double Input in the model and check again for the path of the subsystem file being edited.

    add_block('simulink/Sinks/Scope',...
        'slexModelUsingReusableSS/Double Input/Scope');
    Simulink.SubsystemReference.getAllDirtyInstances(model)
    ans = 
    'slexReusableSS'
    

    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 files referenced in a model that are currently being edited, returned as a character vector or cell array of character vectors. The subsystem files may be edited directly or through an instance. The type of output depends on the input type. If you specify the path of model, the function returns the paths of subsystem files.

    Version History

    Introduced in R2022a