| Using Simulink | ![]() |
Working with Block Parameters
Every Simulink block has a set of attributes, called parameters or properties, that govern its appearance and its behavior during simulation. Some types of attributes are common to all blocks. For example, all blocks have a block name attribute. Other attributes are specific to a particular type of block. For example, only Gain blocks have a Gain parameter. Simulink allows you to specify values for many of a block's attributes, thus enabling you to customize the block's appearance or behavior to fit the requirements of a particular application.
Simulink provides the following means for specifying block parameters:
The model editor's Format menu allows you to specify attributes of the currently selected block that are visible on the model's block diagram, such as the block's name and color (see Changing a Block's Appearance for more information).
Specifies various attributes that are common to all blocks (see Block Properties Dialog Box for more information).
Every block has a dialog box that allows you to specify values for attributes that are specific to that type of block. See Displaying a Block's Parameter Dialog Box for information on displaying a block's parameter dialog box. For information on the parameter dialog of a specific block, see the block's documentation in Simulink Blocks in the online Simulink Help.
The Model Explorer allows you to quickly find one or more blocks and set their properties, thus facilitating global changes to a model, for example, changing the gain of all of a model's Gain blocks. See The Model Explorer for more information.
The set_param enables you to use M-file programs and scripts to specify block attributes. See set_param in the online documentation for more information.
Displaying a Block's Parameter Dialog Box
You can also display a block's parameter dialog box by double-clicking it in the model or library window.
| Note This holds true for all blocks with parameter dialog boxes except for Subsystem blocks. You must use the model editor's Edit menu or context menu to display a Subsystem block's parameter dialog box. |
You can also display a block's parameter dialog box by selecting the block in the model's block diagram and choosing BLOCK Parameters from the model window's Edit menu or from the model window's context (right-click) menu, where BLOCK is the name of the block you selected, e.g., Constant Parameters.
Specifying Parameter Values
You can use a MATLAB constant, model or base workspace variable, or expression that evaluates to a numerical value to specify the value of a numeric parameter. If the value is the name of a workspace variable or MATLAB expression, Simulink evaluates the variable or expression when it compiles the model to determine the parameter's value. If the variable is not defined in the model or MATLAB workspace or the expression uses variables that are not defined in the model or MATLAB workspace, Simulink halts the compilation and displays an error message.
| Note You can specify a parameter's data type as well as its value. See Specifying Block Parameter Data Types for more information. |
| Moving Blocks in a Model | Working with Tunable Parameters | ![]() |
© 1994-2005 The MathWorks, Inc.