Main Content

getDestinationElement

Gets data elements selected on destination port for connection

Since R2020b

    Description

    selectedElems = getDestinationElement(connector) gets the selected data elements on a destination port for a connection.

    example

    Examples

    collapse all

    Get the selected element on the destination port for a connection.

    Create a model and get its root architecture.

    modelName = "archModel";
    arch = systemcomposer.createModel(modelName);
    systemcomposer.openModel(modelName);
    rootArch = get(arch,"Architecture");

    Add a component, create an output port on the component, create an output port on the architecture. and extract both component port objects.

    newComponent = addComponent(rootArch,"Component2");
    outPortComp = addPort(newComponent.Architecture,...
    "testSig2","out");
    outPortArch = addPort(rootArch,"testSig2","out");
    compSrcPort = getPort(newComponent,"testSig2");
    archDestPort = getPort(rootArch,"testSig2");

    Add data interface, create data element, and set the data interface on the architecture port.

    interface = arch.InterfaceDictionary.addInterface("interface2");
    interface.addElement("x");
    archDestPort.setInterface(interface);

    Connect the ports and get the destination element of the connector.

    conns = connect(compSrcPort,archDestPort,DestinationElement="x");
    elem = getDestinationElement(conns)
    elem =
    
      1×1 cell array
    
        {'x'}

    Input Arguments

    collapse all

    Connection between ports, specified as a systemcomposer.arch.Connector object.

    Output Arguments

    collapse all

    Selected data element names, returned as a character vector.

    Data Types: char

    More About

    collapse all

    Version History

    Introduced in R2020b