| Simulink® | ![]() |
Ports & Subsystems, Sources
Inport blocks are the links 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, it is assigned 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 block already in the system. If the copied Inport block port number is not in sequence, you must renumber the block or you will get an error message when you run the simulation or update the block diagram.
You can specify the dimensions of the input to the Inport block using the Port dimensions parameter, or let Simulink software determine it automatically by providing a value of -1.
The Sample time parameter is the rate at which the signal is coming into the system. A value of -1 causes the block to inherit its sample time from the block driving it. You might need to set this parameter for Inport blocks in a top-level system or in models where Inport blocks are driven by blocks whose sample times cannot be determined. See Specifying Sample Time in the online documentation for more information.
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, although the block continues to receive its signal from the same block outside the subsystem.
The Inport block name appears in the Subsystem icon as a port label. To suppress display of the label, select the Inport block and choose Hide Name from the Format menu.
Inport blocks in a top-level system have two uses:
To supply external inputs from the workspace, use either the Configuration Parameters dialog (see Importing Data from a Workspace) or the ut argument of the sim command (see sim) to specify the inputs.
To provide a means for perturbation of the model by the linmod and trim analysis functions, use Inport blocks to define the points where inputs are injected into the system.
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. Changing a duplicate's properties changes the original's properties and vice versa.
To create a duplicate of an Inport block,
Select Copy from the Simulink Edit menu or from the block's context menu.
Position the mouse cursor in the model's block diagram where you want to create the duplicate.
Select Paste Duplicate Inport from the Simulink Edit menu or the block diagram's context menu.
The Inport block accepts complex or real signals of any data type supported by Simulink software, including fixed-point data types. For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink®.
The numeric and data types of the block's output are the same as those of its input. You can specify the signal type, data type, and sampling mode of an external input to a root-level Inport block using the Signal type, Data type, and Sampling mode parameters.
The elements of a signal array connected to a root-level Inport block must be of the same numeric and data types. Signal elements connected to a subsystem input port can be of differing numeric and data types except in the following circumstance: If the subsystem contains an Enable or Trigger block or is an Atomic Subsystem and the input port, or an element of the input port, is connected directly to an output port, the input elements must be of the same type. For example, consider the follow enabled subsystem.

In this example, the elements of a signal vector connected to In1 must be of the same type. The elements connected to In2, however, can be of differing types.
The Main pane of the Inport block dialog appears as follows:

Specify the port number of the Inport block.
Specifies the information to be displayed on the icon of this input port. The options are:
Port number | Displays port number of this port. |
Signal name | Displays the name of the signal connected to this port (or signals if the input is a bus). |
Port name and signal name | Displays both the port number and the names of the signals connected to this port. |
This option applies only to triggered subsystems and is enabled only if the Inport block resides in a triggered subsystem. If selected, the block outputs the value of the input signal at the previous time step. This enables Simulink software to resolve data dependencies among triggered subsystems that are part of a loop. Type sl_subsys_semantics at the MATLAB® prompt for examples using latched inputs with triggered subsystems.
The Inport block indicates that this option is selected by displaying <Lo>.

This option applies only to function-call subsystems and hence is enabled only if the Inport block resides in a function-call subsystem. Selecting this option causes Simulink software to copy the signal output by the block into a buffer before executing the contents of the subsystem and to use this copy as the block's output during execution of the subsystem. This ensures that the subsystem's inputs, including those generated by the subsystem's context, will not change during execution of the subsystem. Type sl_subsys_semantics at the MATLAB prompt for examples using latched inputs with function-call subsystems.
The Inport block displays <Li> to indicate that this option is selected.

Select this parameter to cause the block to interpolate or extrapolate output at time steps for which no corresponding workspace data exists when loading data from the workspace. See Importing Data from a Workspace for more information.
The Signal Attributes pane of the Inport block dialog appears as follows:

Select this option to use a bus object to define the structure of the bus created by this block (see Working with Data Objects and Simulink.Bus class to learn how to create bus objects).
This option is enabled only if you select the Specify properties via bus object option. It specifies the name of the bus object that defines the structure that a bus must have to be connected to this input port. At the beginning of a simulation or when you update the model's diagram, Simulink software checks whether the bus connected to this input port has the specified structure. If not, Simulink software displays an error message.
This option is enabled only if you select the Specify properties via bus object option. If this option is selected, this block outputs a nonvirtual bus; otherwise, it outputs a virtual bus (see Virtual and Nonvirtual Buses). Select this option if you want code generated from this model to use a C structure to define the structure of the bus signal output by this block.
Specify the dimensions of the input signal to the Inport block. Valid values are:
-1 | Dimensions are inherited from input signal |
n | Vector signal of width n accepted |
[m n] | Matrix signal having m rows and n columns accepted |
Specify the sample time of the input signal. See Specifying Sample Time.
Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:
Simulation range checking (see Checking Signal Ranges)
Automatic scaling of fixed-point data types
Specify the output data type of the external input. You can set it to:
A rule that inherits a data type, for example, Inherit: auto
The name of a built-in data type, for example, single
The name of a data type object, for example, a Simulink.NumericType object
An expression that evaluates to a data type, for example, float('single')
Click the Show data type assistant button
to display the Data
Type Assistant, which helps you set the Data
type parameter.
See Specifying Block Output Data Types for more information.
Specify the numeric type (real or complex) of the external input. To accept either type, set this parameter to auto.
Specify the sampling mode (Sample based or Frame based) that the input signal must match. To accept any sampling mode, set this parameter to auto. This parameter is intended to support signal processing applications based on Simulink models. See the documentation for the buffer function provided by Signal Processing Toolbox™ software or Frame-Based Signals in the Signal Processing Blockset™ documentation for information about frame-based signals.
Sample Time | Specified in the Sample time parameter |
Dimensionalized | Yes |
Multidimensionalized | Yes |
![]() | Index Vector | Integer Delay | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |