Main Content

setType

Set shared type on data element or function argument

Since R2021b

    Description

    setType(dataElement,type) sets a type on a data element or a function argument.

    example

    Examples

    collapse all

    model = systemcomposer.createModel("archModel");
    systemcomposer.openModel("archModel");
    dictionary = model.InterfaceDictionary;
    airspeedType = dictionary.addValueType("AirSpeed");
    port = model.Architecture.addPort("inPort","in");
    interface = port.createInterface("DataInterface");
    element = interface.addElement("newElement");
    element.setType(airspeedType)

    Open the Interface Editor from the Modeling > Design menu. Observe the new value type AirSpeed under the model archModel.slx dictionary. Switch from Dictionary View to Port Interface View on the right. Observe the owned data element on the port interface inPort called newElement with Type defined as AirSpeed.

    Input Arguments

    collapse all

    Type, specified as a systemcomposer.interface.DataInterface, for data elements only, or systemcomposer.ValueType object.

    More About

    collapse all

    Version History

    Introduced in R2021b

    See Also

    Functions

    Objects

    Blocks

    Tools