Simulink Reference | ![]() ![]() |
Add a line to a Simulink system.
Syntax
h = add_line('sys','oport','iport') h = add_line('sys','oport','iport', 'autorouting','on') h = add_line('sys', points)
Description
The add_line
command adds a line to the specified system and returns a handle to the new line. You can define the line in two ways:
add_line('sys', 'oport', 'iport')
adds a straight line to a system from the specified block output port 'oport'
to the specified block input port 'iport'
. 'oport'
and 'iport'
are strings consisting of a block name and a port identifier in the form 'block/port'
. Most block ports are identified by numbering the ports from top to bottom or from left to right, such as 'Gain/1'
or 'Sum/2'
. Enable, Trigger, and State ports are identified by name, such as 'subsystem_name/Enable'
, 'subsystem_name/Trigger'
, or 'Integrator/State'
.
add_line('sys','oport','iport', 'autorouting','on')
works like add_line('sys','oport','iport')
except that it routes the line around intervening blocks. The default value for autorouting is 'off'
.
add_line(system, points)
adds a segmented line to a system. Each row of the points
array specifies the x and y coordinates of a point on a line segment. The origin is the top left corner of the window. The signal flows from the point defined in the first row to the point defined in the last row. If the start of the new line is close to the output of an existing block or line, a connection is made. Likewise, if the end of the line is close to an existing input, a connection is made.
Examples
This command adds a line to the mymodel
system connecting the output of the Sine Wave block to the first input of the Mux block.
This command adds a line to the mymodel
system extending from (20,55
) to (40,10
) to (60,60
).
See Also
delete_line
![]() | add_block | add_param | ![]() |