Access node of simulation logging data tree using slash-delimited path
node = get(
simscape.logging.Node object associated with the specified path,
simlogPath, in the simulation logging data tree,
simlog. Before you call this object function, you must 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
This object function provides an alternative method of traversing a simulation logging
data tree, by using a slash-delimited path of block names instead of a dot-delimited path of
node IDs. It is especially convenient if your model contains blocks with non-ASCII
characters in their names, because these names are not easily translatable into node IDs.
The added benefit is tab completion, which lets you specify
with little or no typing.
Get Node Using Full Block Path Name and Tab Completion
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_ssc_dcmotor (as specified by the Workspace
variable name model configuration parameter) in your current
Get the node corresponding to the Inertia block in the DC Motor subsystem:
n = get(simlog_ssc_dcmotor,'DC Motor/Inertia')
n = Node with properties: id: 'Inertia' savable: 1 exportable: 0 t: [1×1 simscape.logging.Node] w: [1×1 simscape.logging.Node] I: [1×1 simscape.logging.Node]
n is the
Node object corresponding to the
Inertia block in the DC Motor subsystem.
Note that the path starts with a block name (
DC Motor), not with
the name of the model (
Instead of typing the path, you can use tab completion.
Start by typing the partial command that includes the name of the simulation log variable:
m = get(simlog_ssc_dcmotor,
and press the Tab key.
The function adds a double quote to the command line and opens a drop-down list of
all the top-level blocks in the model diagram. From this drop-down list, select
DC Motor/. The function adds this name to the path:
m = get(simlog_ssc_dcmotor,"DC Motor/
Press the Tab key again and select
the drop-down list. Close the double quotes and the parentheses, then press
m = get(simlog_ssc_dcmotor,"DC Motor/Inertia/")
m = Node with properties: id: 'Inertia' savable: 1 exportable: 0 t: [1×1 simscape.logging.Node] w: [1×1 simscape.logging.Node] I: [1×1 simscape.logging.Node]
m is also the
Node object corresponding to the
Inertia block in the DC Motor subsystem, equivalent to
simlog — Simulation log variable
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 in the
Simscape pane of the Configuration Parameters dialog box.
simlogPath — Path to node
character vector | string scalar
Path to a node in a simulation logging data tree, specified as a slash-delimited path of block, port, and variable names. The path must start with a block name, not with the name of the model.
node — Node in the simulation data log tree corresponding to the specified path
Node in the simulation data log tree corresponding to the specified path, returned
Node object. The
Node object, which is of
simscape.logging.Node, contains logged simulation data for the
specified block, port, or variable. Generates an error if the node is not found.
Introduced in R2020b