Simulink.BlockPath

Fully specified Simulink block path

Description

A Simulink.BlockPath object represents a fully specified block path that uniquely identifies a block within a model hierarchy, even when the model hierarchy references the same model multiple times.

Creation

Use either the Simulink.BlockPath (described here) or the gcbp function to create a Simulink.BlockPath object. To get a Simulink.BlockPath object for the most recently clicked or loaded block, use the gcbp function.

Description

bp = Simulink.BlockPath creates an empty BlockPath object.

bp = Simulink.BlockPath(blockpath) creates a copy of the specified BlockPath object.

example

bp = Simulink.BlockPath(paths) creates a BlockPath object from the specified cell array of character vectors. Each character vector represents a path at a level of model hierarchy. Simulink® builds the full block path based on the character vectors.

bp = Simulink.BlockPath(paths,subpath) creates a BlockPath object from the character vector or cell array of character vectors that you specify with the paths argument. The object contains a path for an individual component of the block, such as a signal, that you specify with the subpath argument.

Input Arguments

expand all

BlockPath object that you want to copy.

Paths used to build the block path, specified as a character vector or cell array of character vectors.

Specify each character vector in order, from the top model to the specific block for which you are creating a BlockPath object.

Each character vector must be a path to a block within the Simulink model. The block must be:

  • A block in a single model

  • A Model block (except for the last character vector, which may be a block other than a Model block)

  • A block in the model referenced by the Model block that the previous character vector specifies

Individual component of a block, such as a signal, specified as a character vector.

Output Arguments

expand all

The Simulink.BlockPath object that represents the specified block path.

Properties

expand all

A fully specified block path that uniquely identifies a block within a model hierarchy, even when the model hierarchy references the same model multiple times, specified as a character vector.

Example: 'sf_car/shift_logic'

Data Types: char

A component of the block, specified as a character vector that provides the block path. For example, if the block path refers to a Stateflow® chart, you can use SubPath to indicate the chart signals.

Example: 'gear_state.first'

Data Types: char

Object Functions

convertToCellConvert a block path to a cell array of character vectors
getBlockGet a single block path in a model reference hierarchy
getLengthGet the number of hierarchy levels in a block path
openOpen the specified model, library, subsystem, or block
validateDetermine whether the block path represents a valid block hierarchy

Examples

collapse all

Create a block path object called bp2, using a cell array of character vectors representing elements of the block path.

sldemo_mdlref_depgraph
bp2 = Simulink.BlockPath({'sldemo_mdlref_depgraph/thermostat', ...
'sldemo_mdlref_heater/Fahrenheit to Celsius', ...
'sldemo_mdlref_F2C/Gain1'})
bp2 = 

  Simulink.BlockPath
  Package: Simulink

  Block Path:
    sldemo_mdlref_depgraph/thermostat
      sldemo_mdlref_heater/Fahrenheit to Celsius
        sldemo_mdlref_F2C/Gain1

The resulting block path reflects the model reference hierarchy for the block path

Introduced in R2010b