simscape.logging.findPath
Description
[
returns a logical value and a path to the node in the simulation data tree
isvalid
nodepath
]
= simscape.logging.findPath(simlog
,block
)simlog
. The node contains logged simulation data for
the specified block or subsystem in a model. Before you call this function, you
must load the model. You must also have the simulation log variable in your
current workspace. Create the simulation log variable by simulating the model
with data logging turned on, or load a previously saved variable from a file.
Examples
Find Path for the Current Block Node
Open the Permanent Magnet DC Motor example model, which already has
data logging enabled, and run the simulation to create the simulation
log variable simlog_PermanentMagnetDCMotor
(as
specified by the Workspace variable name model
configuration parameter) in your current workspace:
openExample('simscape/PermanentMagnetDCMotorExample') sim('PermanentMagnetDCMotor');
Open the DC Motor subsystem and select the Inertia block.
Find path to the node corresponding to the selected block:
[a, b] = simscape.logging.findPath(simlog_PermanentMagnetDCMotor,gcbh)
a = 1 b = DC_Motor.Inertia
a
returns 1
, indicating that
the valid path to the node was found. b
is a
character vector containing the path in the simulation log variable to
the Node
object corresponding to the selected
block.
Find Path to the Node Using Full Block Path Name
Open the Permanent Magnet DC Motor example model, which already has
data logging enabled, and run the simulation to create the simulation
log variable simlog_PermanentMagnetDCMotor
(as
specified by the Workspace variable name model
configuration parameter) in your current workspace:
openExample('simscape/PermanentMagnetDCMotorExample') sim('PermanentMagnetDCMotor');
Find path to the node corresponding to the Inertia block in the DC Motor subsystem:
[a, b] = simscape.logging.findPath(simlog_PermanentMagnetDCMotor,'PermanentMagnetDCMotor/DC Motor/Inertia')
a = 1 b = DC_Motor.Inertia
a
returns 1
, indicating that
the valid path to the node was found. b
is a
character vector containing the path in the simulation log variable to
the Node
object corresponding to the selected
block.
Find path to the node corresponding to the top-level model:
[a1, b1] = simscape.logging.findPath(simlog_PermanentMagnetDCMotor,'PermanentMagnetDCMotor')
a1 = 1 b1 = ''
a
1 returns 1
, indicating that
the valid path to the node was found. b1
is an
empty character vector, because
PermanentMagnetDCMotor
is the name of the
top-level model.
Input Arguments
simlog
— Simulation log variable
Node
object
Simulation log workspace variable that contains the logged model
simulation data, specified as a Node
object. You
specify the name of the simulation log variable by using the
Workspace variable name parameter on the
Simscape pane of the Configuration
Parameters dialog box.
block
— Block name or identifier
handle | character vector | string scalar | Simulink.Block
object | SID
Block or subsystem name or identifier, specified as a handle, full
path to a block or subsystem in the model,
Simulink.Block
object, or a valid Simulink
Identifier (SID).
Data Types: double
| char
| string
Output Arguments
isvalid
— Logical value indicating whether the match between block and node is found
0 | 1
Logical value indicating whether the match between block and node is
found, returned as true (1
) or false
(0
). Returns true (1
) if
the simulation data log tree contains a node corresponding to the
specified block. Returns false (0
) if a matching
node was not found. The function can return false if the model is
configured to log data only for selected blocks (rather than for the
whole model) and the specified block was not selected for logging. The
function can also return false if the specified block does not produce
logged simulation data (for example, a Solver Configuration block or a
scope).
nodepath
— Path to the corresponding node in the simulation data log tree
character vector
Path to the node containing logged simulation data for the specified
block, returned as a character vector. If isvalid
returns false (0
), then nodepath
is an empty character vector. If block
is the
top-level model in the block diagram, then nodepath
is also an empty character vector, but isvalid
returns true (1
).
Version History
Introduced in R2020a
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 (한국어)