Main Content


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



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


collapse all

Select all of the hardware components in an architecture model.

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

import systemcomposer.query.*;

Open the Simulink® project file.


Open the model.

m = systemcomposer.openModel('KeylessEntryArchitecture');

Create a query for all the hardware components and run the query, displaying one of them.

constraint = HasStereotype(IsStereotypeDerivedFrom('AutoProfile.HardwareComponent'));
hwComp = find(m,constraint,'Recurse',true,'IncludeReferenceModels',true);
ans =

  1×1 cell array

    {'KeylessEntryArchitecture/FOB Locator System/Center Receiver/PWM'}

Input Arguments

collapse all

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

Example: IsStereotypeDerivedFrom('AutoProfile.HardwareComponent')

Output Arguments

collapse all

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

Introduced in R2019b