主要内容

getInput

Get adapter input port by name

Since R2026a

    Description

    port = getInput(adapter,name) gets the adapter input port specified by port by the name specified by name.

    example

    Examples

    collapse all

    Create an adapter with ports in System Composer™.

    Create a model and get the root architecture.

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

    Create an adapter.

    adapter = rootArch.addAdapter(InputName=["p1"],OutputName=["p3"]);

    Add an input port to the adapter.

    adapter.addInput("p2");

    Get an input port to the adapter by name.

    port = adapter.getInput("p3")
    port = 
    
      ComponentPort with properties:
    
                     Parent: [1×1 systemcomposer.arch.Adapter]
           ArchitecturePort: [1×1 systemcomposer.arch.ArchitecturePort]
                       Name: 'p3'
                  Direction: Output
              InterfaceName: ''
                  Interface: [0×0 systemcomposer.interface.DataInterface]
          InheritsInterface: 1
                 Connectors: [0×0 systemcomposer.arch.Connector]
                  Connected: 0
                      Model: [1×1 systemcomposer.arch.Model]
             SimulinkHandle: 208.0001
        SimulinkModelHandle: 149.0001
                       UUID: '9d9a1241-7fa9-4820-91c9-de6e5aaf268b'
                ExternalUID: ''

    Input Arguments

    collapse all

    Adapter, specified as a systemcomposer.arch.Adapter object.

    Name of input port, specified as a string.

    Example: "in2"

    Data Types: string

    Output Arguments

    collapse all

    Port, specified as a systemcomposer.arch.ComponentPort object.

    More About

    collapse all

    Version History

    Introduced in R2026a