Main Content


Class that represents architecture view


    Use the View class to manage architecture views for a System Composer™ model.


    Create a view.

    objView = createView(objModel)

    The createView method is the constructor for the systemcomposer.view.View class.


    expand all

    Name of view, specified as a character vector.

    Example: 'NewView'

    Data Types: char

    Root element group that defines the view, specified as a systemcomposer.view.ElementGroup object.

    Architecture model where the view belongs, specified as a systemcomposer.arch.Model object.

    Universal unique identifier for a view, specified as a character vector.

    Example: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'

    Data Types: char

    Selection query associated with a view, specified as a systemcomposer.query.Constraint object.

    Grouping criteria, specified as a string array of properties in the form '<profile>.<stereotype>.<property>'.

    Example: {"AutoProfile.MechanicalComponent.mass","AutoProfile.MechanicalComponent.cost"}

    Color of view architecture, specified as a character vector. The color can be a name 'blue', 'black', or 'green' or an RGB value encoded in a hexadecimal string '#FF00FF' or '#DDDDDD'. An invalid color results in an error.

    Example: color = get(objViewArchitecture,'Color')

    Description of view architecture, specified as a character vector.

    Example: description = get(objView,'Description')

    Example: set(objView,'Description',description)

    Data Types: char

    Whether to include referenced models, specified as a logical with values 1 (true) or 0 (false).

    Example: included = get(objView,'IncludeReferenceModels')

    Data Types: logical

    Object Functions

    modifyQueryModify architecture view query and property groupings
    runQueryRe-run architecture view query on model
    removeQueryRemove architecture view query
    destroyRemove model element


    collapse all

    This example shows how to use a keyless entry system to programmatically create architecture views using API.

    1. Import the package with the queries.

    import systemcomposer.query.*;

    2. Open the Simulink® project file for the Keyless Entry System.


    3. Load the example model into System Composer™.

    zcModel = systemcomposer.loadModel('KeylessEntryArchitecture');

    Example 1: Hardware Component Review Status View

    Create a filtered view that selects all of the hardware components in the architecture model and groups them using the ReviewStatus property.

    1. Construct the query to select all of the hardware components.

    hwCompQuery = HasStereotype(IsStereotypeDerivedFrom('AutoProfile.HardwareComponent'))
    hwCompQuery = 
      HasStereotype with properties:
        AllowedParentConstraints: {1x3 cell}
                   SubConstraint: [1x1 systemcomposer.query.IsStereotypeDerivedFrom]
                  SkipValidation: 0

    2. Use the query to create a view.

    zcModel.createView('Hardware Component Review Status',...
     'Select',hwCompQuery,... % Query to use for the selection
     'GroupBy',{'AutoProfile.BaseComponent.ReviewStatus'},... % Stereotype property to qualify by
     'IncludeReferenceModels',true,... % Include components in referenced models

    3. Open the Architecture Views Gallery.


    Example 2: FOB Locator System Supplier View

    This example shows how to create a freeform view that manually pulls the components from the FOB Locator System and then groups them using existing and new view components for the suppliers. In this example, you will use element groups, groupings of components in a view, to programmatically populate a view.

    1. Create a view architecture.

    fobSupplierView = zcModel.createView('FOB Locator System Supplier Breakdown',...

    2. Add a subgroup called 'Supplier D'. Add the FOB Locator Module to the view element subgroup.

    supplierD = fobSupplierView.Root.createSubGroup('Supplier D');
    supplierD.addElement('KeylessEntryArchitecture/FOB Locator System/FOB Locator Module');

    3. Create a new subgroup for 'Supplier A'.

    supplierA = fobSupplierView.Root.createSubGroup('Supplier A');

    4. Add each of the FOB Receivers to view element subgroup.

    FOBLocatorSystem = zcModel.lookup('Path','KeylessEntryArchitecture/FOB Locator System');
    % Find all the components which contain the name "Receiver"
    receiverCompPaths = zcModel.find(...

    More About

    expand all

    Introduced in R2021a