add_line

Add line to 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:

  • By naming the block ports that are to be connected by the line

  • By specifying the location of the points that define the line segments

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, State, and Action ports are identified by name, such as 'subsystem_name/Enable', 'subsystem_name/Trigger', 'Integrator/State', or if_action_subsystem_name/Ifaction'.

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.

add_line('mymodel','Sine Wave/1','Mux/1')

This command adds a line to the mymodel system extending from (20,55) to (40,10) to (60,60).

add_line('mymodel',[20 55; 40 10; 60 60])

See Also

Was this topic helpful?