Main Content

simscape.logging.sli.findPath

(To be removed) Find path to node in logged simulation data tree

simscape.logging.sli.findPath will be removed in a future release. Use simscape.logging.findPath instead. Syntax and arguments of the two functions are identical.

Description

[isvalid nodepath] = simscape.logging.sli.findPath(simlog,block) returns a logical value and a path to the node in the simulation data tree 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.

example

Examples

collapse all

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

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.sli.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.sli.findPath(simlog_PermanentMagnetDCMotor,'PermanentMagnetDCMotor')
a1 =

     1


b1 =

     ''

a1 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

collapse all

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

collapse all

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

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 R2015a

collapse all

R2020a: simscape.logging.sli.findPath will be removed

simscape.logging.sli.findPath will be removed in a future release. Use simscape.logging.findPath instead. Syntax and arguments of the two functions are identical, but the new function is more efficient.

To update your code, just remove ".sli" from function calls.