Main Content

getSourceElement

Gets signal elements selected on source port for connection

    Description

    example

    selectedElems = getSourceElement(connector) gets selected signal elements on source port for connection specified by connector.

    Examples

    collapse all

    Get the selected element on source port for a connection.

    modelName = 'archModel';
    arch = systemcomposer.createModel(modelName); % Create model
    rootArch = get(arch,'Architecture'); % Get architecture
    
    newComponent = addComponent(rootArch,'Component1'); % Add component
    inPortComp = addPort(newComponent.Architecture,...
    'testSig','in'); % Create in-port on component
    inPortArch = addPort(rootArch,'testSig','in'); % Create in-port on architecture
    compDestPort = getPort(newComponent,'testSig'); % Extract component port object
    archSrcPort = getPort(rootArch,'testSig'); % Extract architecture port object
    
    interface = arch.InterfaceDictionary.addInterface('interface'); % Add interface
    interface.addElement('x'); % Create interface element
    archSrcPort.setInterface(interface); % Set interface on architecture port
    
    conns = connect(archSrcPort,compDestPort,'SourceElement','x'); % Connect ports
    elem = getSourceElement(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 signal element names, returned as a character vector.

    Data Types: char

    Introduced in R2020b