Using Simulink    

Copying and Moving Blocks from One Window to Another

As you build your model, you often copy blocks from Simulink block libraries or other libraries or models into your model window. To do this, follow these steps:

  1. Open the appropriate block library or model window.
  2. Drag the block to copy into the target model window. To drag a block, position the cursor over the block icon, then press and hold down the mouse button. Move the cursor into the target window, then release the mouse button.

You can also drag blocks from the Simulink Library Browser into a model window. See Browsing Block Libraries for more information.

You can also copy blocks by using the Copy and Paste commands from the Edit menu:

  1. Select the block you want to copy.
  2. Choose Copy from the Edit menu.
  3. Make the target model window the active window.
  4. Choose Paste from the Edit menu.

Simulink assigns a name to each copied block. If it is the first block of its type in the model, its name is the same as its name in the source window. For example, if you copy the Gain block from the Math library into your model window, the name of the new block is Gain. If your model already contains a block named Gain, Simulink adds a sequence number to the block name (for example, Gain1, Gain2). You can rename blocks; see Manipulating Block Names.

When you copy a block, the new block inherits all the original block's parameter values.

Simulink uses an invisible five-pixel grid to simplify the alignment of blocks. All blocks within a model snap to a line on the grid. You can move a block slightly up, down, left, or right by selecting the block and pressing the arrow keys.

You can display the grid in the model window by typing the following command in the MATLAB window.

To change the grid spacing, enter

For example, to change the grid spacing to 20 pixels, enter

For either of the above commands, you can also select the model, then enter gcs instead of <model name>.

You can copy or move blocks to compatible applications (such as word processing programs) using the Copy, Cut, and Paste commands. These commands copy only the graphic representation of the blocks, not their parameters.

Moving blocks from one window to another is similar to copying blocks, except that you hold down the Shift key while you select the blocks.

You can use the Undo command from the Edit menu to remove an added block.


  Editing Blocks Moving Blocks in a Model