Main Content

Common Block Properties

This table lists the properties common to all Simulink® blocks, including block callback properties (see Customize Model Behavior with Callbacks). Examples of commands that change these properties follow this table (see Examples of Setting Block Properties).

Common Block Properties

PropertyDescriptionValues

AncestorBlock

Name of the library block that the block is linked to (for blocks with a disabled link).

character vector

AttributesFormatString

Block annotation text (corresponds to block properties).

character vector

BackgroundColor

Block background color.

color value |'[r,g,b]' | '[r,g,b,a]'

r, g, and b, are the red, green, blue values of the color in the range 0.0 to 1.0. If specified, the alpha value (a) is ignored.

Possible color values are 'black', 'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'gray', 'lightBlue', 'orange', 'darkGreen'.

BlockDescription

Block description shown at the top of the block parameters dialog box or property inspector.

character array

BlockType

Block type (read-only).

character array

BlockKeywords

Associates one or more keywords with a custom library block.

character vector | string scalar | string array

BlockMirrorBlock mirror.

{'off'} | 'on'

BlockRotationBlock rotation angle.

double number of 0 for 0 degrees rotation. 270 for 270 degree rotation.

ClipboardFcn

Function called when block is copied to the clipboard (Ctrl+C) or when the menu item Copy is selected.

function | character vector

CloseFcn

Function called when close_system is run on block.

function | character vector

CommentedExclude block from simulation.

{'off'} | 'on' | 'through'

CompiledBusType

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 get_param. For example:

ports = get_param(gcb,'PortHandles');
feval(gcs,[],[],[],'compile');
bt = get_param(ports.Outport,'CompiledBusType')

See Display Bus Information.

'NOT_BUS' | 'VIRTUAL_BUS' | 'NON_VIRTUAL_BUS'

CompiledIsActive

Specifies whether the block status is active at compile time.

CompiledIsActive returns off if any one of these conditions is true at compile time:

  • Block is an inactive path of an inline variant.

  • Block is an inactive choice of a variant subsystem.

  • Block is in a subsystem that is commented out.

  • Block is inactive due to a condition propagated from a variant subsystem.

CompiledisActive returns off for inactive choices and returns on for active choices of a variant subsystem.

'off' | 'on'

CompiledPortComplexSignals

Complexity of port signals after updating diagram. You must compile the model before querying this property. For example:

openExample('simulink_general/VanDerPolOscillatorExample');
vdp([],[],[],'compile');
d = get_param(gcb,'CompiledPortComplexSignals');
vdp([],[],[],'term');
structure array

CompiledPortDataTypes

Data types of port signals after updating diagram. You must compile the model before querying this property. See CompiledPortComplexSignals .

structure array

CompiledPortDesignMin

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

CompiledPortDesignMax

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

CompiledPortDimensions

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

CompiledPortDimensionsMode

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.

double number. 0 indicates the signal does not have a variable size. 1 indicates the signal has a variable size.

CompiledPortFrameData

Frame mode of port signals after updating diagram. You must compile the model before querying this property.

structure array

CompiledPortUnits

Structure array of block port units (after updating diagram). You must compile the model before querying this property.

structure array

CompiledPortWidths

Structure of port widths after updating diagram. You must compile the model before querying this property.

structure array

CompiledSampleTime

Block sample time after updating diagram. You must compile the model before querying this property.

vector [sample time, offset time]

or

cell {[sample time 1, offset time 1]; [sample time 2, offset time 2];.....[sample time n, offset time n]}

ContinueFcn

Function called at the restart of a simulation (after a pause).

function | character vector

CopyFcn

Function called when block is copied. See Block Callbacks for details.

function | character vector

DataTypeOverrideCompiled

For internal use.

 

DeleteFcn

Function called when block is deleted. See Block Callbacks for details.

MATLAB® expression

DestroyFcn

Function called when block is destroyed. See Block Callbacks for details.

MATLAB expression

Description

Description of block. Set by the Description field in the General pane of the Block Properties dialog box.

text and tokens

Diagnostics

For internal use.

 

DialogParameters

List of names/attributes of block-specific parameters for an unmasked block, or mask parameters for a masked block.

structure

DropShadow

Display drop shadow.

{'off'} | 'on'

ExtModeLoggingSupported

Enable a block to support uploading of signal data in external mode, for example, with a scope block.

{'off'} | 'on'

ExtModeLoggingTrig

Enable a block to act as the trigger block for external mode signal uploading.

{'off'} | 'on'

ExtModeUploadOptionEnable 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'

FontAngle

Font angle.

'normal' | 'italic' | 'oblique' | {'auto'}

FontName

Font name.

character array

FontSize

Font size. A value of -1 specifies that this block inherits the font size specified by the DefaultBlockFontSize model parameter.

real {'-1'}

FontWeight

Font weight.

'light' | 'normal' | 'demi' | 'bold' | {'auto'}

ForegroundColor

Foreground color of block icon.

color value |'[r,g,b]' | '[r,g,b,a]'

r, g, and b, are the red, green, blue values of the color in the range 0.0 to 1.0. The value changes if it is too similar to the canvas color (ScreenColor parameter). Use get_param to return the actual value. If specified, the alpha value (a) is ignored.

Possible color values are 'black', 'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'gray', 'lightBlue', 'orange', 'darkGreen'.

Handle

Block handle.

real

HideAutomaticName

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'

HiliteAncestors

For internal use.

 

InitFcn

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

InputSignalNames

Names of input signals.

cell array

IntrinsicDialogParameters

List of names/attributes of block-specific parameters (regardless of whether the block is masked or unmasked). Use instead of DialogParameters if you want block-specific parameters for masked or unmasked blocks.

structure

IOSignalStrings

Block paths to objects that are connected to the Viewers & Generators Manager. Simulink software saves these paths when the model is saved.

list

IOType

Viewers & Generators Manager type. For internal use.

 

IsStateOwnerBlock

Indicates whether the block is a supported state owner block that can be used with the State Reader and State Writer blocks (read-only). See State Reader and State Writer.

'off' | 'on'

LibraryVersion

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 — {'1.1'}

LineHandles

Handles of lines connected to block.

structure

LinkData

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 [] to reset to deparameterized, for example, set_param(gcb,'linkData',[]).

cell array

LinkStatus

Link status of block. Updates out-of-date linked blocks when queried using get_param.

See Control Linked Block Programmatically.

'none' | 'resolved' | 'unresolved' | 'implicit' | 'inactive' | 'restore' | 'propagate' | 'propagateHierarchy' | 'restoreHierarchy'

LoadFcn

Function called when block is loaded.

MATLAB expression

MinMaxOverflowLogging_Compiled

For internal use.

 

ModelCloseFcn

Function called when model is closed. The ModelCloseFcn is called prior to the block DeleteFcn and DestroyFcn callbacks, if either are set.

MATLAB expression

ModelParamTableInfo

For internal use.

 

MoveFcn

Function called when block is moved.

MATLAB expression

Name

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');

To propagate the signal name, compile the model. In the Simulink Toolstrip, on the Modeling tab, click Update Model.

Alternatively, to name an output signal of a block, you can use SignalNameFromLabel.

character vector

NameChangeFcn

Function called when block name is changed.

MATLAB expression

NamePlacement

Position of block name.

{'normal'} | 'alternate'

ObjectParameters

Names/attributes of block parameters.

structure

OpenFcn

Function called when this Block Parameters dialog box opens.

MATLAB expression

Orientation

Where block faces.

{'right'} | 'left' | 'up' | 'down'

OutputSignalNames

Names of output signals.

cell array

Parent

Name of the system that owns the block.

character vector {'untitled'}

ParentCloseFcn

Function called when parent subsystem is closed. The ParentCloseFcn of blocks at the root model level is not called when the model is closed.

MATLAB expression

PauseFcn

Function called at the pause of a simulation.

function | character vector

PortConnectivity

The value of this property is an array of structures, each of which describes one of the block input or output ports. Each port structure has the following fields:

  • Type

    Specifies the port type and/or number. The value of this field can be:

    • n, where n is the number of the port for data ports

    • 'enable' if the port is an enable port

    • 'trigger' if the port is a trigger port

    • 'state' for state ports

    • 'ifaction' for action ports

    • 'LConn#' for a left connection port where # is the port number

    • 'RConn#' for a right connection port where # is the port number

    • 'event' for reinitialize event ports of subsystems

  • Position

    The value of this field is a two-element vector, [x y], that specifies the port position.

  • SrcBlock

    Handle of the block connected to this port. This field is [] for output ports and -1 for unconnected input ports. SrcBlock property is a valid source handle for Variant Subsystem blocks.

  • SrcPort

    Number of the port connected to this port, starting at zero. This field is [] for both output ports and unconnected input ports.

  • DstBlock

    Handle of the block to which this port is connected. This field is [] for input ports and contains a 1-by-0 empty matrix for unconnected output ports.

  • DstPort

    Number of the port to which this port is connected, starting at zero. This field is [] for input ports and contains a 1-by-0 empty matrix for unconnected output ports. For Simscape™ blocks, the field contains port handles.

structure array

PortHandles

The value of this property is a structure that specifies the handles of the block ports. The structure has the following fields:

  • Inport

    Handles of the input ports.

  • Outport

    Handles of the output ports.

  • Enable

    Handle of the enable port.

  • Trigger

    Handle of the trigger port.

  • State

    Handle of the state port.

  • LConn

    Handles of the left connection ports (for blocks that support Physical Modeling tools).

  • RConn

    Handles of the right connection ports (for blocks that support Physical Modeling tools).

  • Ifaction

    Handle of the action port.

  • Reset

    Handle of the reset port.

  • Event

    Handles of the subsystem reinitialize event ports.

structure array

PortRotationType

Type of port rotation used by this block (read-only).

'default' | 'physical'

Ports

A vector that specifies the number of each kind of port this block has. The order of the vector elements corresponds to the following port types:

  • Inport

  • Outport

  • Enable

  • Trigger

  • State

  • LConn

  • RConn

  • Ifaction

  • Reset

  • Event

vector

Position

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 get_param to return the actual position.

vector of coordinates, in pixels: [left top right bottom]

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.

PostSaveFcn

Function called after the block is saved.

MATLAB expression

PreCopyFcn

Function called before the block is copied. See Block Callbacks for details. MATLAB expression

PreDeleteFcn

Function called before the block is deleted. See Block Callbacks for details. MATLAB expression

PreSaveFcn

Function called before the block is saved. See Block Callbacks for details.

MATLAB expression

Priority

Specifies the block 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 {''}

ReferenceBlock

Name of the library block to which this block links.

character vector {''}

RequirementInfo

For internal use.

 

RTWData

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.

 

SampleTime

Value of the sample time parameter. See Specify Sample Time for more details.

character vector

Selected

Status of whether or not block is selected.

{'on'} | 'off'

ShowName

Display or hide block name.

To display a block name given by the Simulink Editor (automatic names), set the block 'HideAutomaticName' parameter to 'off' and ShowName to 'on'. To hide an automatic block name given by the Editor, set ShowName to 'on', HideAutomaticName to 'on', and HideAutomaticNames on the model to 'on'. For more information on how the parameters interact, see Hide or Display Block Names.

{'on'} | 'off'

SignalHierarchy

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 get_param. For example:

ports = get_param(gcb,'PortHandles');
feval(gcs,[],[],[],'compile');
sh = get_param(ports.Outport,'SignalHierarchy')

See Display Bus Information.

values reflect the structure of the signal that you specify

StartFcn

Function called at the start of a simulation.

MATLAB expression

StatePerturbationForJacobian

State perturbation size to use during linearization. See Change Perturbation Level of Blocks Perturbed During Linearization (Simulink Control Design) for details.

character vector

StaticLinkStatus

Link status of block. Does not update out-of-date linked blocks when queried using get_param. See also LinkStatus.

'none' | 'resolved' | 'unresolved' | 'implicit' | 'inactive' | 'restore' | 'propagate' | 'propagateHierarchy' | 'restoreHierarchy'

StopFcn

Function called at the termination of a simulation.

MATLAB expression

Tag

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 {''}

Type

Simulink object type (read-only).

'block'

UndoDeleteFcn

Function called when block deletion is undone.

MATLAB expression

UserData

User-specified data that can have any MATLAB data type.

{'[]'}

UserDataPersistent

Status of whether or not UserData will be saved in the model file.

'on' | {'off'}

VariantConfigurationObjectSpecifies the variant configuration object that is associated with the model. See Save and Reuse Variant Configurations Using Variant Configuration Data Object.{''}
The value is an empty character vector if no configuration object is associated; otherwise, it is the name of a Simulink.VariantConfigurationData object.

Examples of Setting Block Properties

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])

See Also

|

Related Topics