Main Content

simscape.logging.sli.findPath

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

simscape.logging.sli.findPathwill be removed in a future release. Usesimscape.logging.findPathinstead. Syntax and arguments of the two functions are identical.

Description

example

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

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 variablesimlog_ssc_dcmotor(as specified by theWorkspace variable namemodel configuration parameter) in your current workspace:

ssc_dcmotor sim('ssc_dcmotor');

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_ssc_dcmotor,gcbh)
a = 1 b = DC_Motor.Inertia

areturns1, indicating that the valid path to the node was found.bis a character vector containing the path in the simulation log variable to the节点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 variablesimlog_ssc_dcmotor(as specified by theWorkspace variable namemodel configuration parameter) in your current workspace:

ssc_dcmotor sim('ssc_dcmotor');

Find path to the node corresponding to the Inertia block in the DC Motor subsystem:

[a, b] = simscape.logging.sli.findPath(simlog_ssc_dcmotor,'ssc_dcmotor/DC Motor/Inertia')
a = 1 b = DC_Motor.Inertia

areturns1, indicating that the valid path to the node was found.bis a character vector containing the path in the simulation log variable to the节点object corresponding to the selected block.

Find path to the node corresponding to the top-level model:

[a1, b1] = simscape.logging.sli.findPath(simlog_ssc_dcmotor,'ssc_dcmotor')
a1 = 1 b1 = ''

a1 returns1, indicating that the valid path to the node was found.b1is an empty character vector, becausessc_dcmotoris 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节点object. You specify the name of the simulation log variable by using theWorkspace variable nameparameter on theSimscapepane of the Configuration Parameters dialog box.

块or subsystem name or identifier, specified as a handle, full path to a block or subsystem in the model,Simulink.Blockobject, 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. Ifisvalidreturns false (0), thennodepathis an empty character vector. Ifblockis the top-level model in the block diagram, thennodepathis also an empty character vector, butisvalid返回true (1).

他的版本tory

Introduced in R2015a

expand all

Warns starting in R2020a