HasPort

Create query to select architecture elements with port on component based on specified sub-constraint

    Description

    example

    query = HasPort(sub-constraint) creates a query object that the find method and the createViewArchitecture method use to select architecture elements with a port that satisfies the given sub-constraint.

    Examples

    collapse all

    Select all of the sensor component ports in an architecture model.

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

    import systemcomposer.query.*;
    

    Open the Simulink® project file.

    scKeylessEntrySystem

    Open the model.

    m = systemcomposer.openModel('KeylessEntryArchitecture');

    Create a query for all the ports in a component with 'Sensor' in the 'Name' and run the query.

    constraint = HasPort(contains(Property('Name'),'Sensor'));
    sensorComp = find(m,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.

    Example: contains(Property('Name'),'Sensor')

    Output Arguments

    collapse all

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

    Introduced in R2019b