Contents

Inport

Create input port for subsystem or external input

Library

Ports & Subsystems, Sources

Description

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, 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 block 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 specify the dimensions of the input to the Inport block using the Port dimensions parameter. Entering a value of -1 lets Simulink determine the port dimension.

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.

  • Models with blocks where Simulink cannot determine the sample time, but these blocks drive Inport blocks.

For more information, see Specify Sample Time.

Inport Blocks in a Top-Level System

Inport blocks in a top-level system have two uses:

  • To supply external inputs from the workspace, use the Configuration Parameters dialog box (see Techniques for Importing Signal Data) or the ut argument of the sim command (see sim) to specify the inputs. If no external outputs are supplied, then the default output is the ground value.

  • To provide a means for perturbation of the model by the linmod and trim analysis functions, use Inport blocks to inject inputs into the system.

Inport Blocks in a Subsystem

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 Format > Hide Name.

Inport blocks inside a subsystem support signal label propagation, but root-level Inport blocks do not.

You can use a subsystem inport to supply fixed-point data in a structure or any other format.

Creating Duplicate Inports

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 properties of a duplicate changes properties of the original and vice versa.

To create a duplicate of an Inport block:

  1. In the block diagram, select the block that you want to duplicate.

  2. In the Model Editor menu bar, select Edit > Copy.

  3. In the block diagram, place your cursor where you want to place the duplicate.

  4. Select Edit > Paste Duplicate Inport.

Connecting Buses to Root Level Inports

If you want a root level Inport of a model to produce a bus signal, you must set the Data type parameter to the name of a bus object that defines the bus that the Inport produces. For more information, see Bus Objects.

Data Type Support

The Inport block accepts complex or real signals of any data type that Simulink supports, including fixed-point and enumerated data types. The Inport block also accepts a bus object as a data type.

    Note:   If you specify a bus object as the data type for this block, do not set the minimum and maximum values for bus data on the block. Simulink ignores these settings. Instead, set the minimum and maximum values for bus elements of the bus object specified as the data type. The values should be finite real double scalar.

    For information on the Minimum and Maximum properties of a bus element, see Simulink.BusElement.

For more information, see Data Types Supported by Simulink.

The numeric and data types of the block 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, Trigger, or Atomic Subsystem block and the input port, or an element of the input port, connects directly to an output port, the input elements must be of the same type. For example, consider the following 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.

Parameters and Dialog Box

The Main pane of the Inport block dialog box appears as follows:

The Signal Attributes pane of the Inport block dialog box appears as follows:

Port number

Specify the port number of the block.

Settings

Default: 1

This parameter controls the order in which the port that corresponds to the block appears on the parent subsystem or model block.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Icon display

Specify the information to be displayed on the icon of this input port.

Settings

Default: Port number

Signal name

Display the name of the signal connected to this port (or signals if the input is a bus).

Port number

Display port number of this port.

Port number and signal name

Display both the port number and the names of the signals connected to this port.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Latch input by delaying outside signal

Output the value of the input signal at the previous time step.

Settings

Default: Off

On

Output the value of the input signal at the previous time step.

Off

Do not output the value of the input signal at the previous time step.

Tips

  • This option applies only to triggered subsystems and is enabled only if the Inport block resides in a triggered subsystem.

  • Selecting this check box enables Simulink to resolve data dependencies among triggered subsystems that are part of a loop.

  • Type sl_subsys_semanticssl_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>.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Latch input for feedback signals of function-call subsystem outputs

Latch the value of the input to this subsystem and prevent this value from changing during the execution of the subsystem. For a single function call that is branched to invoke multiple function-call subsystems, this option allows you to break a loop formed by a signal fed back from one of these function-call subsystems into the other. A second functionality of this option is to prevent any change to the values of a feedback signal from a function-call subsystem that is invoked during the execution of this subsystem.

Settings

Default: Off

On

Latch the input value.

Off

Do not latch the input value.

Tips

  • This parameter applies only to function-call subsystems and is enabled only if the Inport block resides in a function-call subsystem.

  • This parameter ensures that the subsystem inputs, including those generated within the subsystem's context, do not change during execution of the subsystem.

  • The Inport block indicates that this option is selected by displaying <Li>.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Interpolate data

When loading data from the workspace, cause the block to linearly interpolate and extrapolate output at time steps for which no corresponding data exists.

To load discrete signal data from the workspace, in the Inport block dialog box:

  1. Set the Sample time parameter to a discrete value, such as 2.

  2. Clear the Interpolate data parameter.

Specifying the discrete sample time causes the simulation to have hit times exactly at those instances when the discrete data is sampled. You only need to specify the data values, not time values.

Turning interpolation off avoids unexpected data values at other simulation time points as a result of double precision arithmetic processing. For more information, see Import Data to Test a Discrete Algorithm.

Settings

Default: On

On

When loading data from the workspace, cause the block to linearly interpolate and extrapolate output at time steps for which no corresponding data exists.

Off

When loading data from the workspace, do not cause the block to linearly interpolate or extrapolate output at time steps for which no corresponding data exists. Simulink uses the following interpolation and extrapolation:

  • For time steps between the first specified data point and the last specified data point — zero-order hold

  • For time steps before the first specified data point and after the last specified data point — ground value

Command-Line Information

See Block-Specific Parameters for the command-line information.

Output function call

Specify that the input signal is outputting a function-call trigger signal.

Settings

Default: Off

On

Input signal is a function-call trigger signal.

Off

Input signal is not a function-call trigger signal.

Tips

  • Select this option if it is necessary for a current model to accept a function-call trigger signal when referenced in the top model.

  • This feature is limited to an asynchronous function call.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Minimum

Specify the minimum value that the block should output.

Settings

Default: [] (unspecified)

This number must be a finite real double scalar value.

    Note:   If you specify a bus object as the data type for this block, do not set the minimum value for bus data on the block. Simulink ignores this setting. Instead, set the minimum values for bus elements of the bus object specified as the data type. For information on the Minimum property of a bus element, see Simulink.BusElement.

Simulink software uses this value to perform:

  • Simulation range checking (see Signal Ranges)

  • Automatic scaling of fixed-point data types

Command-Line Information

See Block-Specific Parameters for the command-line information.

Maximum

Specify the maximum value that the block should output.

Settings

Default: [] (unspecified)

This number must be a finite real double scalar value.

    Note:   If you specify a bus object as the data type for this block, do not set the maximum value for bus data on the block. Simulink ignores this setting. Instead, set the maximum values for bus elements of the bus object specified as the data type. For information on the Maximum property of a bus element, see Simulink.BusElement.

Simulink software uses this value to perform:

  • Simulation range checking (see Signal Ranges)

  • Automatic scaling of fixed-point data types

Command-Line Information

See Block-Specific Parameters for the command-line information.

Data type

Specify the output data type of the external input.

Settings

Default: Inherit: auto

Inherit: auto

A rule that inherits a data type

double

Data type is double.

single

Data type is single.

int8

Data type is int8.

uint8

Data type is uint8.

int16

Data type is int16.

uint16

Data type is uint16.

int32

Data type is int32.

uint32

Data type is uint32.

boolean

Data type is boolean.

fixdt(1,16,0)

Data type is fixed point fixdt(1,16,0).

fixdt(1,16,2^0,0)

Data type is fixed point fixdt(1,16,2^0,0).

Enum: <class name>

Data type is enumerated, for example, Enum: Basic Colors.

Bus: <object name>

Data type is a bus object.

<data type expression>

The name of a data type object, for example Simulink.NumericType

Do not specify a bus object as the expression.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Show data type assistant

Display the Data Type Assistant.

Settings

The Data Type Assistant helps you set the Output data type parameter.

For more information, see Specify Block Output Data Types.

Mode

Select the category of data to specify.

Settings

Default: Inherit

Inherit

Inheritance rule for data types. Selecting Inherit enables a second menu/text box to the right.

Built in

Built-in data types. Selecting Built in enables a second menu/text box to the right. Select one of the following choices:

  • double (default)

  • single

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

  • boolean

Fixed point

Fixed-point data types.

Enumerated

Enumerated data types. Selecting Enumerated enables a second menu/text box to the right, where you can enter the class name.

Bus

Bus object. Selecting Bus enables a Bus object parameter to the right, where you enter the name of a bus object that you want to use to define the structure of the bus. If you need to create or change a bus object, click Edit to the right of the Bus object field to open the Simulink Bus Editor. For details about the Bus Editor, see Manage Bus Objects with the Bus Editor.

Expression

Expressions that evaluate to data types. Selecting Expression enables a second menu/text box to the right, where you can enter the expression.

Do not specify a bus object as the expression.

Dependency

Clicking the Show data type assistant button enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specify Data Types Using Data Type Assistant.

Data type override

Specify data type override mode for this signal.

Settings

Default: Inherit

Inherit

Inherits the data type override setting from its context, that is, from the block, Simulink.Signal object or Stateflow® chart in Simulink that is using the signal.

Off

Ignores the data type override setting of its context and uses the fixed-point data type specified for the signal.

Tip

The ability to turn off data type override for an individual data type provides greater control over the data types in your model when you apply data type override. For example, you can use this option to ensure that data types meet the requirements of downstream blocks regardless of the data type override setting.

Dependency

This parameter appears only when the Mode is Built in or Fixed point.

Signedness

Specify whether you want the fixed-point data as signed or unsigned.

Settings

Default: Signed

Signed

Specify the fixed-point data as signed.

Unsigned

Specify the fixed-point data as unsigned.

Dependencies

Selecting Mode > Fixed point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Word length

Specify the bit size of the word that holds the quantized integer.

Settings

Default: 16

Minimum: 0

Maximum: 32

Dependencies

Selecting Mode > Fixed point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Scaling

Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors.

Settings

Default: Best precision

Binary point

Specify binary point location.

Slope and bias

Enter slope and bias.

Best precision

Specify best-precision values.

Dependencies

Selecting Mode > Fixed point enables this parameter.

Selecting Binary point enables:

  • Fraction length

  • Calculate Best-Precision Scaling

Selecting Slope and bias enables:

  • Slope

  • Bias

  • Calculate Best-Precision Scaling

See Also

For more information, see Specifying a Fixed-Point Data Type.

Fraction length

Specify fraction length for fixed-point data type.

Settings

Default: 0

Binary points can be positive or negative integers.

Dependencies

Selecting Scaling > Binary point enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Slope

Specify slope for the fixed-point data type.

Settings

Default: 2^0

Specify any positive real number.

Dependencies

Selecting Scaling > Slope and bias enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Bias

Specify bias for the fixed-point data type.

Settings

Default: 0

Specify any real number.

Dependencies

Selecting Scaling > Slope and bias enables this parameter.

See Also

For more information, see Specifying a Fixed-Point Data Type.

Output as nonvirtual bus

Output a nonvirtual bus.

Settings

Default: Off

On

Output a nonvirtual bus.

Off

Output a virtual bus.

Tips

  • 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.

  • All signals in a nonvirtual bus must have the same sample time, even if the elements of the associated bus object specify inherited sample times. Any bus operation that would result in a nonvirtual bus that violates this requirement generates an error. Therefore, if you select this option all signals in the bus must have the same sample time. You can use a Rate Transition block to change the sample time of an individual signal, or of all signals in a bus, to allow the signal or bus to be included in a nonvirtual bus.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Lock output data type setting against changes by the fixed-point tools

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor.

Settings

Default: Off

On

Locks the output data type setting for this block.

Off

Allows the Fixed-Point Tool and the Fixed-Point Advisor to change the output data type setting for this block.

Command-Line Information

Parameter: LockScale
Type: string
Value: 'off' | 'on'
Default: 'off'

See Also

For more information, see Use Lock Output Data Type Setting.

Port dimensions (-1 for inherited)

Specify the dimensions of the input signal to the block.

Settings

Default: -1

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

Command-Line Information

See Block-Specific Parameters for the command-line information.

Variable-size signal

Specify the type of signals allowed into this port.

Settings

Default: Inherit

Inherit

Allow variable-size and fixed-size signals.

No

Do not allow variable-size signals.

Yes

Allow only variable-size signals.

Dependencies

When the signal at this port is a variable-size signal, the Port dimensions parameter specifies the maximum dimensions of the signal.

Command-Line Information

Parameter: VarSizeSig
Type: string
Value: 'Inherit'| 'No' | 'Yes'
Default: 'Inherit'

Sample time (-1 for inherited)

Specify the time interval between samples.

Settings

Default: -1

To inherit the sample time, set this parameter to -1.

See Specify Sample Time in the online documentation for more information.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Signal type

Specify the numeric type of the external input.

Settings

Default: auto

auto

Accept either real or complex as the numeric type.

real

Specify the numeric type as a real number.

complex

Specify the numeric type as a complex number.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Sampling mode

Specify whether the output signal is Sample based or Frame based.

Settings

Default: auto

auto

Accept any sampling mode.

Sample based

The output signal is sample-based.

Frame based

The output signal is frame-based.

Dependency

Frame-based processing requires a DSP System Toolbox™ license.

For more information, see Sample- and Frame-Based Concepts in the DSP System Toolbox documentation.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Characteristics

Sample Time

Specified in the Sample time parameter

Dimensionalized

Yes

Multidimensionalized

Yes

Virtual

Yes, if the block does not reside in a conditionally-executed or atomic subsystem and does not connect directly to an Outport block

For more information, see Virtual Blocks in the Simulink documentation.

Zero-Crossing Detection

No

Was this topic helpful?