This table lists the properties common to all Simulink® blocks, including block callback properties (see Callbacks for Customized Model Behavior). Examples of commands that change these properties follow this table (see Examples of Setting Block Properties).
Common Block Properties
Property | Description | Values |
---|---|---|
| Name of the library block that the block is linked to (for blocks with a disabled link). | character vector |
| Block annotation text (corresponds to block properties). | character vector |
| Block background color. | color value |
Possible color values are |
| Block description shown at the top of the block parameters dialog box or property inspector. | character array |
| Returns | 'model' | 'library' |
| Block type (read-only). | character array |
BlockKeywords | Associates one or more keywords with a custom library block. | character vector | string scalar | string array |
| Function called when block is copied to the clipboard (Ctrl+C) or when the menu item Copy is selected. | function |
| Function called when | function |
Commented | Exclude block from simulation. |
|
| Returns whether the signal connected to a port is not a bus, is a virtual, or is a nonvirtual bus (read-only). Specify a port or line handle when using
ports = get_param(gcb,'PortHandles'); feval(gcs,[],[],[],'compile'); bt = get_param(ports.Outport,'CompiledBusType') |
|
| Specifies whether the block status is active or not at compile time.
|
|
| Complexity of port signals after updating diagram. You must compile the model before querying this property. For example: vdp([],[],[],'compile'); d = get_param(gcb,'CompiledPortComplexSignals'); vdp([],[],[],'term'); | structure array |
|
Data types of port signals after updating diagram. You must compile the model before
querying this property. See | structure array |
| Design minimum of port signals after updating diagram. You must compile the model before querying this property. For example: feval(gcs, [],[],[],'compile'); ports = get_param(gcb,'PortHandles'); min = get_param(ports.Outport, 'CompiledPortDesignMin') feval(model, [],[],[],'term'); | structure array |
| Design maximum of port signals at compile time. You must compile the model before querying this property. For example: feval(gcs, [],[],[],'compile'); ports = get_param(gcb,'PortHandles'); max = get_param(ports.Outport, 'CompiledPortDesignMax') feval(model, [],[],[],'term'); | structure array |
| Dimensions of port signals after updating diagram. You must compile the model before querying this property. For details, see Get Compiled Port Dimensions. | numeric array |
| Indication whether the port signal has a variable size (after updating diagram). You must compile the model before querying this property. See Determine Whether Signal Line Has Variable Size. |
|
| Frame mode of port signals after updating diagram. You must compile the model before querying this property. | structure array |
| Structure of port widths after updating diagram. You must compile the model before querying this property. | structure array |
| Block sample time after updating diagram. You must compile the model before querying this property. | vector [ cell {[ |
| Function called at the restart of a simulation (after a pause). | function |
| Function called when block is copied. See Block Callback Parameters for details. | function |
| For internal use. | |
| Function called when block is deleted. See Block Callback Parameters for details. | MATLAB® expression |
| Function called when block is destroyed. See Block Callback Parameters for details. | MATLAB expression |
| Description of block. Set by the Description field in the General pane of the Block Properties dialog box. | text and tokens |
| For internal use. | |
| List of names/attributes of block-specific parameters for an unmasked block, or mask parameters for a masked block. | structure |
| Display drop shadow. |
|
| Enable a block to support uploading of signal data in external mode (for example, with a scope block). |
|
| Enable a block to act as the trigger block for external mode signal uploading. |
|
ExtModeUploadOption | Enable a block to upload signal data in external mode when
the Select all check box on the External Signal
& Triggering dialog box is not selected. A value of log indicates
the block uploads signals. A value of none indicates
the block does not upload signals. The value monitor is
currently not in use. If the Select all check
box on the External Signal & Triggering dialog box is selected,
it overrides this parameter setting. | {'none'} | 'log' | 'monitor' |
| Font angle. |
|
| Font name. | character array |
| Font size. A value of -1 specifies that this block inherits
the font size specified by the | real |
| Font weight. |
|
| Foreground color of block icon. | color value
Possible color values are |
| Block handle. | real |
| Specify whether the block name given automatically by the Simulink Editor displays in the model. To hide automatic names, use the default setting
of 'on' . (The HideAutomaticNames parameter for the
model must also be set to 'on' .) Set to 'off' to
display the name, and also set the block ShowName parameter to
'on' . Blocks whose ShowName parameter is
'off' are hidden regardless of this setting. For more information on how
the parameters interact, see Hide or Display Block Names. | {'on'} | 'off' |
| For internal use. | |
| Initialization function for a block. Created on the Callbacks pane of the Model Properties dialog box. For more information, see Create Model Callbacks. On non-masked blocks, updating the diagram or running the simulation call this function. | MATLAB expression |
| Names of input signals. | cell array |
| List of names/attributes of block-specific parameters
(regardless of whether the block is masked or unmasked). Use instead
of | structure |
| Block paths to objects that are connected to the Signal & Scope Manager. Simulink software saves these paths when the model is saved. | list |
| Signal & Scope Manager type. For internal use. | |
| For a linked block, the initial value of this property is the ModelVersion of
the library at the time the link was created. The value updates with
increments in the model version of the library. | character vector — { |
| Handles of lines connected to block. | structure |
| Array of details about changes to the blocks inside the link that differ between a
parameterized link and its library, listing the
block names and parameter values. Use
| cell array |
| Link status of block. Updates out-of-date linked blocks
when queried using |
|
| Function called when block is loaded. | MATLAB expression |
| For internal use. | |
| Function called when model is closed. The | MATLAB expression |
| For internal use. | |
| Function called when block is moved. | MATLAB expression |
| Block or signal name. To specify a signal name, use the corresponding port or line handle. ports = get_param(gcb,'PortHandles'); set_param(ports.Outport(1), 'Name', 'NewName'); Alternatively,
to name an output signal of a block, you can use
| character vector |
| Function called when block name is changed. | MATLAB expression |
| Position of block name. |
|
| Names/attributes of block's parameters. | structure |
| Function called when this Block Parameters dialog box opens. | MATLAB expression |
| Where block faces. |
|
| Names of output signals. | cell array |
| Name of the system that owns the block. | character vector |
| Function called when parent subsystem is closed. The | MATLAB expression |
| Function called at the pause of a simulation. | function |
| The value of this property is an array of structures, each of which describes one of the block's input or output ports. Each port structure has the following fields:
| structure array |
| The value of this property is a structure that specifies the handles of the block's ports. The structure has the following fields:
| structure array |
| Type of port rotation used by this block (read-only). |
|
| A vector that specifies the number of each kind of port this block has. The order of the vector's elements corresponds to the following port types:
| vector |
| Position of block in model window. To help
with block alignment, the position you set can differ from the actual
block position by a few pixels. Use | vector of coordinates, in pixels: The origin is the upper-left corner of the Simulink Editor canvas before any canvas resizing. Supported coordinates are between -1073740824 and 1073740823, inclusive. Positive values are to the right of and down from the origin. Negative values are to the left of and up from the origin. |
| Function called after the block is saved. | MATLAB expression |
| Function called before the block is copied. See Block Callback Parameters for details. | MATLAB expression |
| Function called before the block is deleted. See Block Callback Parameters for details. | MATLAB expression |
| Function called before the block is saved. See Block Callback Parameters for details. | MATLAB expression |
| Specifies the block's order of execution relative to other blocks in the same model. Set by the Priority field on the General pane of the Block Properties dialog box. | character vector |
| Name of the library block to which this block links. | character vector |
| For internal use. | |
| User specified data, used by Simulink Coder™ software. Intended only for use with user written S-functions. See the section S-Function RTWdata (Simulink Coder) for details. | |
| Value of the sample time parameter. See Specify Sample Time for more details. | character vector |
| Status of whether or not block is selected. |
|
| Display or hide block name. To display a block name given by the Simulink Editor (automatic names), set the block |
|
| If the signal is a bus, returns the name and hierarchy of the signals in the bus (read-only). Specify a port or line handle when using
ports = get_param(gcb,'PortHandles'); feval(gcs,[],[],[],'compile'); sh = get_param(ports.Outport,'SignalHierarchy') | values reflect the structure of the signal that you specify |
| Function called at the start of a simulation. | MATLAB expression |
| State perturbation size to use during linearization. See Change Perturbation Level of Blocks Perturbed During Linearization (Simulink Control Design) for details. | character vector |
| Link status of block. Does not update out-of-date linked
blocks when queried using | 'none' | 'resolved' | 'unresolved' | 'implicit' |
'inactive' | 'restore' | 'propagate' | 'propagateHierarchy' | 'restoreHierarchy' |
| Function called at the termination of a simulation. | MATLAB expression |
| Text that appears in the block label that Simulink software generates. Set by the Tag field on the General pane of the Block Properties dialog box. | character vector |
| Simulink object type (read-only). |
|
| Function called when block deletion is undone. | MATLAB expression |
| User-specified data that can have any MATLAB data type. |
|
| Status of whether or not |
|
These examples illustrate how to change common block properties.
This command changes the orientation of the Gain block in the mymodel
system
so it faces the opposite direction (right to left).
set_param('mymodel/Gain','Orientation','left')
This command associates an OpenFcn
callback
with the Gain block in the mymodel
system.
set_param('mymodel/Gain','OpenFcn','my_open_cb')
This command sets the Position
property of
the Gain block in the mymodel
system. The block
is 75 pixels wide by 25 pixels high.
set_param('mymodel/Gain','Position',[50 250 125 275])