Main Content

HasPort

Create query to select architectural elements with port based on specified subconstraint

    Description

    query = HasPort(subconstraint) creates a query query that the find and createView functions use to select architectural elements with a port that satisfies the given subconstraint subconstraint.

    example

    Examples

    collapse all

    Import the namespace that contains all of the System Composer™ queries.

    import systemcomposer.query.*

    Open the Simulink® project file for the keyless entry system.

    openProject("scKeylessEntrySystem");

    Load the architecture model.

    model = systemcomposer.loadModel("KeylessEntryArchitecture");

    Create a query for all the elements with ports containing Sensor in the Name and run the query.

    constraint = HasPort(contains(Property("Name"),"Sensor"));
    sensorComp = find(model,constraint,Recurse=true,IncludeReferenceModels=true)
    sensorComp = 1×1 cell array
        {'KeylessEntryArchitecture/Door Lock//Unlock System/Door Lock Controller'}
    
    

    Input Arguments

    collapse all

    Condition restricting the query, specified as a systemcomposer.query.Constraint object.

    Output Arguments

    collapse all

    Query, returned as a systemcomposer.query.Constraint object.

    More About

    collapse all

    Version History

    Introduced in R2019b