Main Content

HasInterfaceElement

Create query to select architecture elements with interface element on interface based on specified sub-constraint

    Description

    example

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

    Examples

    collapse all

    Select all of the port interface elements in an architecture model with matching criteria.

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

    import systemcomposer.query.*;
    

    Open the Simulink® project file.

    scExampleSmallUAV

    Open the model.

    m = systemcomposer.openModel('scExampleSmallUAVModel');
    

    Create a query for all the interface elements with 'c' in the 'Name' and run the query.

    constraint = HasPort(HasInterface(HasInterfaceElement(contains(Property('Name'),'c'))));
    elements = find(m,constraint,'Recurse',true,'IncludeReferenceModels',true)
    
    elements =
    
      4×1 cell array
    
        {'scExampleSmallUAVModel/FlightComputer'           }
        {'scExampleSmallUAVModel/FlightComputer/Main Board'}
        {'scExampleSmallUAVModel/Payload'                  }
        {'scExampleSmallUAVModel/Payload/Payload'          }

    Input Arguments

    collapse all

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

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

    Output Arguments

    collapse all

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

    Introduced in R2019b