| Simulink Reference | ![]() |
Add a block to a Simulink system
Syntax
add_block('src', 'dest') add_block('src', 'dest', 'param1', value1, ...)add_block('src', 'dest', 'MakeNameUnique', 'on', 'param1', value1, ...)add_block('src_inport', 'dest_inport','copyoption', 'duplicate', 'param1', value1,...)
Description
add_block('src', 'dest') copies the block with the full pathname 'src' to a new block with the full path name 'dest'. The block parameters of the new block are identical to those of the original. The name 'built-in' can be used as a source system name for all Simulink built-in blocks (blocks available in Simulink block libraries that are not masked blocks).
add_block('src', 'dest', 'param1', value1, ...) creates a copy as above, in which the named parameters have the specified values. Any additional arguments must occur in parameter/value pairs.
add_block('src', 'dest', 'MakeNameUnique', 'on', 'parameter1', value1,...) creates a copy of src. If a block having the full path name dest already exists, the command creates a unique name for the new block based on dest's name.
add_block('src_inport', 'dest_inport', 'copyoption', 'duplicate', 'param1', value1,...) applies only to Inport blocks. It creates a copy with the same port number as the 'src' block.
Before you add a block, you need to first open the library that contains the block with the load_system (library opens invisibly) or open_system (library opens visibly) command.
Examples
This command copies the Scope block from the Sinks subsystem of the simulink system to a block named Scope1 in the timing subsystem of the engine system.
This command creates a new subsystem named controller in the F14 system.
This command copies the built-in Gain block to a block named Volume in the mymodel system and assigns the Gain parameter a value of 4.
copies the block named Mu in vdp and create a copy. Since Mu already exists, the command names the new block Mu1.
See Also
| Model Construction Commands | add_line | ![]() |
© 1994-2005 The MathWorks, Inc.