Create input port for subsystem or external input
Simulink / Commonly Used Blocks
Simulink / Ports & Subsystems
Simulink / Sources
HDL Coder / Commonly Used Blocks
HDL Coder / Ports & Subsystems
HDL Coder / Sources
Inport blocks link signals from outside a system into the system.
Simulink® software assigns Inport block port numbers according to these rules:
It automatically numbers the Inport blocks within a top-level system or subsystem sequentially, starting with 1.
If you add an Inport block, the label is the next available number.
If you delete an Inport block, other port numbers are automatically renumbered to ensure that the Inport blocks are in sequence and that no numbers are omitted.
If you copy an Inport block into a system, its port number is not renumbered unless its current number conflicts with an inport already in the system. If the copied Inport block port number is not in sequence, renumber the block. Otherwise, you get an error message when you run the simulation or update the block diagram.
You can use an Inport block in a top-level system to:
Supply external inputs from the workspace using one of these approaches. If no external outputs are supplied, then the default output is the ground value.
Use the Configuration Parameters > Data Import/Export > Input parameter. See Load Data to Root-Level Input Ports.
Tip
To import many signals to root-level input ports, consider using the Root Inport Mapper tool. For more information, see Map Data Using Root Inport Mapper Tool.
Use the ut
argument of the sim
command to
specify the inputs.
Provide a means for perturbation of the model by the
linmod
and trim
analysis
functions.
Use Inport blocks to inject inputs into the system. See Linearizing Models.
To load logged signal data using root Inport blocks, use
the
function to create a
createInputDataset
Dataset
object that contains elements corresponding
to root-level Inport blocks.
Inport blocks in a subsystem represent inputs to the subsystem. A signal
arriving at an input port on a Subsystem block flows out of the
associated Inport block in that subsystem. The Inport
block associated with an input port on a Subsystem block is the block
whose Port number parameter matches the relative position of
the input port on the Subsystem block. For example, the Inport block
whose Port number parameter is 1
gets its
signal from the block connected to the topmost port on the Subsystem
block.
If you renumber the Port number of an Inport block, the block becomes connected to a different input port. The block continues to receive its signal from the same block outside the subsystem.
Inport blocks inside a subsystem support signal label propagation, but root-level Inport blocks do not.
Tip
For models that include bus signals composed of many bus elements, consider using In Bus Element and Out Bus Element blocks. These blocks:
Reduce signal line complexity and clutter in a block diagram.
Make it easier to change the interface incrementally.
Allow access to a bus element closer to the point of usage, avoiding the use of a Bus Selector and Goto block configuration.
The In Bus Element block is of block type Inport and the Out Bus Element block is of block type Outport.
You can create any number of duplicates of an Inport block. The duplicates are graphical representations of the original intended to simplify block diagrams by eliminating unnecessary lines. The duplicate has the same port number, properties, and output as the original.
To create a duplicate of an Inport block:
In the block diagram, select the unconnected Inport block that you want to duplicate.
Press and hold the Ctrl key and drag the block.
Release the mouse and then select Duplicate from the context menu.
If you want a root-level Inport of a model to produce a bus signal, set the Data type parameter to the name of a bus object that defines the bus that the Inport produces. For more information, see Specify Bus Properties with Simulink.Bus Objects.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
In Bus Element | Outport | Asynchronous Task Specification (Simulink Coder)