Main Content

addElement

Description

element = addElement(interface,name) adds an element to an interface with default properties.

To remove an element from an interface, use the removeElement function.

element = addElement(interface,name,Name=Value) sets the properties of the element using name-value arguments.

example

Examples

collapse all

Create a new model newModel. Add a data interface newInterface to the dictionary of the model. Then, add a data element newElement with data type double.

arch = systemcomposer.createModel("newModel");
interface = addInterface(arch.InterfaceDictionary,"newInterface");
element = addElement(interface,"newElement",DataType="double")
element = 

  DataElement with properties:

      Interface: [1×1 systemcomposer.interface.DataInterface]
           Name: 'newElement'
           Type: [1×1 systemcomposer.ValueType]
           UUID: '2d267175-33c2-43a9-be41-a1be2774a3cf'
    ExternalUID: ''

Create a new model named 'newModel'. Add a physical interface 'newInterface' to the dictionary of the model. Then, add a physical element 'newElement' with type 'electrical.electrical'. Change the physical domain type to 'electrical.six_phase'.

arch = systemcomposer.createModel('newModel');
interface = addPhysicalInterface(arch.InterfaceDictionary,'newInterface');
element = addElement(interface,'newElement','Type','electrical.electrical');
element.Type = 'electrical.six_phase';
element
element = 

  PhysicalElement with properties:

           Name: 'newElement'
           Type: [1×1 systemcomposer.interface.PhysicalDomain]
      Interface: [1×1 systemcomposer.interface.PhysicalInterface]
           UUID: '32e4c51e-e567-42f1-b44a-2d2fcdbb5c25'
    ExternalUID: ''

Input Arguments

collapse all

Element name, specified as a character vector or string. An element name must be a valid MATLAB® variable name.

Data Types: char | string

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: addElement(interface,"newElement",DataType="double",Dimensions="2",Units="m/s",Complexity="complex",Minimum="0",Maximum="100",Description="Maintain altitude")

Data type, specified as a character vector or string for a valid MATLAB data type. The default value is double.

Example: addElement(interface,"newElement",DataType="double")

Data Types: char | string

Dimensions, specified as a character vector or string. The default value is 1.

Example: addElement(interface,"newElement",Dimensions="2")

Data Types: char | string

Units, specified as a character vector or string.

Example: addElement(interface,"newElement",Units="m/s")

Data Types: char | string

Complexity, specified as a character vector or string. The default value is real. Other possible values are complex and auto.

Example: addElement(interface,"newElement",Complexity="complex")

Data Types: char | string

Minimum, specified as a character vector or string.

Example: addElement(interface,"newElement",Minimum="0")

Data Types: char | string

Maximum, specified as a character vector or string.

Example: addElement(interface,"newElement",Maximum="100")

Data Types: char | string

Description, specified as a character vector or string.

Example: addElement(interface,"newElement",Description="Maintain altitude")

Data Types: char | string

Physical domain of physical element, specified as a character vector or string of a partial physical domain name. For a list of valid physical domain names, see Domain-Specific Line Styles (Simscape).

Example: addElement(interface,"newElement",Type="electrical.six_phase")

Data Types: char | string

Output Arguments

collapse all

More About

collapse all

Version History

Introduced in R2019a

See Also

Functions

Objects

Blocks

Tools