Documentation Center

  • Trial Software
  • Product Updates

Common Block Properties

About Common Block Properties

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

PropertyDescriptionValues

AncestorBlock

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

string

AttributesFormatString

String format specified for block annotations in the Block Parameters dialog box.

string

BackgroundColor

Block background color.

RGB value array string | [r,g,b,a] where r, g, b, and a are the red, green, blue, and alpha values of the color normalized to the range 0.0 to 1.0, delineated with commas. The alpha value is optional and ignored.

Block background color can also be 'black', 'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'gray', 'lightBlue', 'orange', 'darkGreen'.

BlockDescription

Block description shown in the Block Properties dialog box.

string

BlockDiagramType

Returns model if it is in an open Simulink block diagram. Returns library if it is a Simulink library.

'model | 'library'

BlockType

Block type (read only).

string

ClipboardFcn

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

string

CloseFcn

Function called when close_system is run on block.

string

CommentedExclude block from simulation.{'off'} | 'on' | 'through'

CompiledPortComplexSignals

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

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. See CompiledPortComplexSignals.

structure array

CompiledPortFrameData

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

structure array

CompiledPortWidths

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

structure array

CompiledSampleTime

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

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

string

CopyFcn

Function called when block is copied. See Block Callback Parameters in the Using Simulink documentation for details.

string

DataTypeOverrideCompiled

For internal use.

 

DeleteFcn

Function called when block is deleted. See Block Callback Parameters in the Using Simulink documentation for details.

MATLAB® expression

DestroyFcn

Function called when block is destroyed. See Block Callback Parameters in the Using Simulink documentation 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.

string

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's icon.

RGB value array string | [r,g,b,a] where r, g, b, and a are the red, green, blue, and alpha values of the color normalized to the range 0.0 to 1.0, delineated with commas. The alpha value is optional and ignored.

Block background color can also be 'black', 'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'gray', 'lightBlue', 'orange', 'darkGreen'.

Handle

Block handle.

real

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 Signal & Scope Manager. Simulink software saves these paths when the model is saved.

list

IOType

Signal & Scope Manager type. For internal use.

 

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.

string — {'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, e.g., set_param(gcb,'linkData',[]).

See Parameterized Links .

cell array

LinkStatus

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

See Check and Set Link Status 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's 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 name.

string

NameChangeFcn

Function called when block name is changed.

MATLAB expression

NamePlacement

Position of block name.

{'normal'} | 'alternate'

ObjectParameters

Names/attributes of block's 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.

string {'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.

string

PortConnectivity

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:

  • Type

    Specifies the port's 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's number

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

  • Position

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

  • SrcBlock

    Handle of the block connected to this port. This field is null for output ports and -1 for unconnected input ports.

  • SrcPort

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

  • DstBlock

    Handle of the block to which this port is connected. This field is null 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 null for input ports and contains a 1-by-0 empty matrix for unconnected output ports.

structure array

PortHandles

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

  • Inport

    Handles of the block's input ports.

  • Outport

    Handles of the block's output ports.

  • Enable

    Handle of the block's enable port.

  • Trigger

    Handle of the block's trigger port.

  • State

    Handle of the block's state port.

  • LConn

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

  • RConn

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

  • Ifaction

    Handle of the block's action port.

structure array

PortRotationType

Type of port rotation used by this block. This is a read-only property.

'default' | 'physical'

Ports

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:

  • Inport

  • Outport

  • Enable

  • Trigger

  • State

  • LConn

  • RConn

  • Ifaction

vector

Position

Position of block in model window.

vector of coordinates (in pixels) not enclosed in quotation marks: [left top right bottom].

    Note:   The origin is located in the upper left corner of the model window. The maximum absolute value for a coordinate is 32767. Positive x and y values are to the right of and down from the origin, respectively, and negative x and y values are to the left of up from the origin, respectively.

PostSaveFcn

Function called after the block is saved.

MATLAB expression

PreCopyFcn

Function called before the block is copied. See Block Callback Parameters in the Using Simulink documentation for details. MATLAB expression

PreDeleteFcn

Function called before the block is deleted. See Block Callback Parameters in the Using Simulink documentation for details. MATLAB expression

PreSaveFcn

Function called before the block is saved. See Block Callback Parameters in the Using Simulink documentation for details.

MATLAB expression

Priority

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.

string {''}

ReferenceBlock

Name of the library block to which this block links.

string {''}

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 in the Simulink Coder documentation for details.

 

SampleTime

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

string

Selected

Status of whether or not block is selected.

{'on'} | 'off'

ShowName

Display block name.

{'on'} | 'off'

StartFcn

Function called at the start of a simulation.

MATLAB expression

StatePerturbationForJacobian

State perturbation size to use during linearization. See Perturbation Level of Blocks Perturbed During Linearization in the Simulink Control Design™ documentation for details.

string

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.

string {''}

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

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. The position vector is not enclosed in quotation marks.

set_param('mymodel/Gain','Position', [50 250 125 275])
Was this topic helpful?