|On this page…|
You can add blocks to a model in several ways.
|Method||When to Use|
|Browse or search libraries with the Library Browser|
|Copy blocks from a model|
|Use the Most Frequently Used Blocks pane or context menu|
|Add blocks programmatically with the add_block function|
To browse or search for a block from a block library installed on your system, use the Library Browser. You can browse a list of block libraries or search for blocks whose names include the search string you specify.
When you find the block you want, select that block in the Library Browser and drag the block into your model. See Populate a Model for more information.
To copy a block from a model in the Simulink® Editor:
Select the block that you want to copy from a model.
Choose Edit > Copy.
In the model window in which you want to place the copied block, choose Edit > Paste.
You can copy a block:
Within the same model window
Between multiple systems open in one Simulink Editor instance
Between systems open in multiple Simulink Editor instances
When you copy a block, the parameters use default values.
For details, see Copy Blocks Between Windows.
When using the same block repeatedly, you can save time by using the Frequently Used feature in the Library Browser or Model Editor.
Open the Frequently Used pane with the third tab in the Library Browser.
To add a block to a model, select the block and do one of the following:
Drag the block into your model.
Right-click the block, and from the context menu select Add to <model_name>.
In the Simulink Editor, you can view a list of your most frequently used blocks. Right-click anywhere in the model except with the cursor directly on a block or signal. In the context menu, select Most Frequently Used Blocks.
The Frequently Used tab lists blocks that you have added most often, with the most frequently used block at the top. The list reflects your ongoing modeling activity. For example, if you add several Gain blocks, the Gain block appears in the list if the list:
Does not already include the Gain block
Has less than 25 blocks
Has 25 blocks, but you added more Gain blocks than the number of instances of the least frequently used block in the list
The list displays blocks that you rename as instances of the library block. For example, if you rename several Gain blocks to be MyGain1, MyGain2, and so on, those blocks count as Gain blocks.
When you close and reopen the Library Browser, the list reflects the blocks that you added up through the previous session. The list updates only when the Library Browser is open.
The list does not reflect blocks that you:
Include in subsystems
If you add a subsystem that uses a specific type of block repeatedly, the list does not reflect that activity.
The list in the Model Editor is the same as the Library Browser list, except that the Model Editor list includes only five blocks.
To add a block programmatically, use the add_block function.
The add_block function copies the parameter values of the source block to the new block. You can use add_block to specify values for parameters of the new block.