Main Content

bdIsSubsystem

Determine whether model is subsystem

    Description

    tf = bdIsSubsystem(sys) returns logical 1 (true) if the specified Simulink® model is a subsystem. Otherwise, bdIsSubsystem returns logical 0 (false).

    example

    Examples

    collapse all

    Load the models.

    h1 = load_system("slexTimesK");
    h2 = load_system("slexSubsystemReferenceContextAdapting");

    Check whether the models are subsystems.

    tf = bdIsSubsystem([h1,h2])
    tf = 1x2 logical array
    
       1   0
    
    

    The function returns the logical array [1 0], which indicates:

    • slexTimesK is a subsystem.

    • slexSubsystemReferenceContextAdapting is not a subsystem.

    Input Arguments

    collapse all

    Name or handle of the loaded model, specified as a string, character vector, or double for a single model, or a string array, cell array, or numeric array for multiple models.

    Example: "slexTimesK"

    Example: ["slexTimesK","slexSubsystemReferenceContextAdapting"]

    Data Types: string | char | double | cell

    Output Arguments

    collapse all

    True or false result, returned as a 1 or 0 of data type logical.

    • 1 (true) — File is a subsystem.

    • 0 (false) — File is not a subsystem.

    When multiple files are specified, the function returns a logical array with one entry for each file.

    Alternatives

    You can also check the type of model using the get_param function:

    get_param("slexTimesK","BlockDiagramType");

    Version History

    Introduced in R2019b