主要Content

Simulink.BlockPath

Fully specified Simulink block path

Description

ASimulink.BlockPathobject 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 theSimulink.BlockPathorgcbpfunction to create aSimulink.BlockPathobject. To get aSimulink.BlockPathobject for the most recently clicked or loaded block, use thegcbpfunction.

Description

bp=仿金宝app真软件。BlockPathcreates an emptyBlockPathobject.

bp=仿金宝app真软件。BlockPath(blockpath)creates a copy of the specifiedBlockPathobject.

example

bp=仿金宝app真软件。BlockPath(paths)creates aBlockPathobject from the specified character vector or cell array of character vectors. Each character vector represents a path at a level of the model hierarchy. Simulink®builds the full block path based on the character vectors.

bp=仿金宝app真软件。BlockPath(paths,subpath)additionally specifies an individual component of the block, such as a signal, that you specify with thesubpathargument.

Input Arguments

expand all

ExistingBlockPathobject that you want to copy, specified as aBlockPathobject.

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

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

  • A block in a single model

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

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

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

Properties

expand all

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 useSubPathto indicate the chart signals.

Example:'gear_state.first'

Data Types:char

Object Functions

convertToCell Convert block path to cell array of character vectors
getBlock Get single block path in model reference hierarchy
getLength Get number of hierarchy levels in block path
open Open specified model, library, subsystem, or block
validate Determine whether block path represents valid block hierarchy

Examples

collapse all

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

sldemo_mdlref_depgraph bp2 = Simulink.BlockPath({“sldemo_mdlref_depgraph /恒温器”,...'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.

中on History

Introduced in R2010b