Main Content

simscape.logging.findNode

Find Node object corresponding to block or subsystem

Since R2020a

Description

example

node = simscape.logging.findNode(simlog,block) returns a simscape.logging.Node object that contains the 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 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 node corresponding to the selected block:

n = simscape.logging.findNode(simlog_PermanentMagnetDCMotor,gcbh)
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 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 node corresponding to the Inertia block in the DC Motor subsystem:

n = simscape.logging.findNode(simlog_PermanentMagnetDCMotor,'PermanentMagnetDCMotor/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.

Find node corresponding to the DC Motor subsystem:

m = simscape.logging.findNode(simlog_PermanentMagnetDCMotor,'PermanentMagnetDCMotor/DC Motor')
m = 

  Node with properties:

                                        id: 'DC_Motor'
                                   savable: 1
                                exportable: 0
                          Rotor_Resistance: [1×1 simscape.logging.Node]
    Rotational_Electromechanical_Converter: [1×1 simscape.logging.Node]
                                   Inertia: [1×1 simscape.logging.Node]
                          Rotor_Inductance: [1×1 simscape.logging.Node]
                                  Friction: [1×1 simscape.logging.Node]

m is the Node object corresponding to the whole DC Motor subsystem.

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

Node in the simulation data log tree corresponding to the specified block, returned as a Node object. The Node object, which is of class simscape.logging.Node, contains logged simulation data for the specified block. Returns empty [] if the node is not found.

Version History

Introduced in R2020a