Create output port for subsystem or external output
Simulink / Commonly Used Blocks
Simulink / Ports & Subsystems
Simulink / Sinks
HDL Coder / Commonly Used Blocks
HDL Coder / Ports & Subsystems
HDL Coder / Sinks
Outport blocks link signals from a system to a destination outside of the system. They can connect signals flowing from a subsystem to other parts of the model. They can also supply external outputs at the top level of a model hierarchy.
Simulink® software assigns Outport block port numbers according to these rules:
It automatically numbers the Outport blocks within a root-level system or subsystem sequentially, starting with 1.
If you add an Outport block, it is assigned the next available number.
If you delete an Outport block, other port numbers are automatically renumbered to ensure that the Outport blocks are in sequence and that no numbers are omitted.
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 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 topmost 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. The block continues to send the signal to the same block outside the subsystem.
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.
Outport blocks at the top level of a model hierarchy have two uses. They can
supply external outputs to the base MATLAB® workspace, and they provide a means for the linmod
and trim
analysis functions to obtain output from the
system.
To supply external outputs to the workspace, use the Configuration Parameters > Data Import/Export pane (see Exporting
Output Data to the MATLAB Workspace) or the
command. For
example, if a system has more than one Outport block and the save
format is array, the following commandsim
[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
, specify this
command:
[t,x,speed,dist] = sim(...);
A root-level Outport block in a model can accept a virtual bus only if all elements of the bus have the same data type. The Outport block automatically unifies the bus to a vector having the same number of elements as the bus, and provides that vector as output.
If you want a root-level Outport of a model to accept a bus signal that
contains mixed types, set Outport block Data
type to Bus: <object name>
. If the bus
signal is virtual, it is converted to nonvirtual, as described in Virtual and Nonvirtual Bus Conversions.
Simulink.Signal
ObjectTo associate a root-level Outport block with a Simulink.Signal
object, use the Model Data Editor. See
For Signals.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|