Using Simulink | ![]() ![]() |
Create an output port for a subsystem or an external output.
Library
Description
Outports are the links from a system to a destination outside the system.
Simulink assigns Outport block port numbers according to these rules:
Outport Blocks in a Subsystem
Outport blocks in a subsystem represent outputs from the subsystem. A signal arriving at an Outport block in a subsystem flows out of the associated output port on that Subsystem block. The Outport block associated with an output port on a Subsystem block is the block whose Port number parameter matches the relative position of the output port on the Subsystem block. For example, the Outport block whose Port number parameter is 1 sends its signal to the block connected to the top-most output port on the Subsystem block.
If you renumber the Port number of an Outport block, the block becomes connected to a different output port, although the block continues to send the signal to the same block outside the subsystem.
When you create a subsystem by selecting existing blocks, if more than one Outport block is included in the grouped blocks, Simulink automatically renumbers the ports on the blocks.
The Outport block name appears in the Subsystem block icon as a port label. To suppress display of the label, select the Outport block and choose Hide Name from the Format menu.
Outport Blocks in a Conditionally Executed Subsystem
When an Outport block is in an enabled subsystem, you can specify what happens to its output when the subsystem is disabled: it can be reset
to an initial value or held
at its most recent value. The Output when disabled pop-up menu provides these options. The Initial output parameter is the value of the output before the subsystem executes and, if the reset
option is chosen, while the subsystem is disabled.
Outport Blocks in a Top-Level System
Outport blocks in a top-level system have two uses: to supply external outputs to the workspace, which you can do by using either the Simulation Parameters dialog box or the sim
command, and to provide a means for analysis functions to obtain output from the system.
sim
command (see sim
). For example, if a system has more than one Outport block and the save format is array, the following command[t,x,y] = sim(...);
writes y
as a matrix, with each column containing data for a different Outport block. The column order matches the order of the port numbers for the Outport blocks.
If you specify more than one variable name after the second (state) argument, data from each Outport block is written to a different variable. For example, if the system has two Outport blocks, to save data from Outport block 1 to speed
and the data from Outport block 2 to dist
, you could specify this command:
[t,x,speed,dist] = sim(...);
linmod
and trim
analysis functions to obtain output from the system. For more information about using Outport blocks with analysis commands, see Chapter 5.Numeric and Data Type Support
An Outport block accepts complex or real signals of any MATLAB data type as input. The numeric and data type of the block's output is the same as that of its input. The elements of a signal array connected to an Outport block can be of differing numeric and data types except in the following circumstance. If the outport is in a conditionally executed subsystem and the initial output is specified, all elements of an input array must be of the same numeric and data type.
Simulink's data type conversion rules apply to an outport's Initial output parameter. If the initial value is in the range of the block's output data type, Simulink converts the initial value to the output data type. If the specified initial output is out of range of the output data type, Simulink halts the simulation and signals an error. Note that the block's output data type is the data type of the signal connected to its input.
Parameters and Dialog Box
Characteristics
Sample Time |
Inherited from driving block |
Dimensionalized |
Yes |
![]() | Mux | Polynomial | ![]() |