relativePath
Get path to node associated with block or subsystem
Description
Examples
Find Relative Path to Block Node in Operating Point Data Tree
Open the Permanent Magnet DC Motor example model and create an
OperatingPoint
object named op
using
the Start
values from the model:
openExample('simscape/PermanentMagnetDCMotorExample') op = simscape.op.create(gcs, 'Start')
op = OperatingPoint with children: OperatingPoints: ChildId Size ______________ ____ 'DC Motor' 1x1 'DC Voltage' 1x1 'ERef' 1x1 'Load Torque' 1x1 'MRRef Motor' 1x1 'MRRef Torque' 1x1 'Sensing' 1x1 'Step Input' 1x1
Open the DC Motor subsystem, select the Inductor block, and find the relative path to this block in the operating point data hierarchy:
relPath = relativePath(op, gcb)
relPath = 'DC Motor/Rotor Inductance'
Find Relative Path to Block in an Empty Operating Point
When you determine the relative path for
a block, the operating point does not need to contain a node
corresponding to that block. You can obtain operating point
data for a block elsewhere, and then use the
relativePath
function to determine
the correct location for inserting this data in the
operating point for the current model.
Open the Permanent Magnet DC Motor example model:
openExample('simscape/PermanentMagnetDCMotorExample')
Create an empty OperatingPoint
object named
op
:
op = simscape.op.OperatingPoint
op = OperatingPoint with no children.
Set the Identifier
property of the
OperatingPoint
object to match the name of the model:
op.Identifier = 'PermanentMagnetDCMotorExample';
In the model, open the DC Motor subsystem, select the Inductor block, and find the relative path to this block in the operating point data hierarchy:
relPath = relativePath(op, gcb)
relPath = 'DC Motor/Rotor Inductance'
Input Arguments
op
— Operating point
OperatingPoint
object
Operating point in the workspace, specified as an
OperatingPoint
object. The
Identifier
property of the
OperatingPoint
object must match the name of the
model.
block
— Block name or identifier
handle | character vector | string scalar | SID
Block or subsystem name or identifier, specified as a handle, full path to a block or subsystem in the model, or a valid Simulink identifier (SID).
Data Types: double
| char
| string
Output Arguments
opPath
— Path to the corresponding node in the operating point data tree
character vector
Path to the node corresponding to the specified block, returned as a
character vector, relative to the root node of the operating point data
tree. The root node is specified by the Identifier
property of the OperatingPoint
object.
Version History
Introduced in R2017b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)