This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Determine whether operating point data contains element at specified path





hasPath(op,opPath) returns true (1) if the operating point data tree contains a node corresponding to the specified relative path, opPath. Returns false (0) if a matching node was not found.


collapse all

When you determine relative path for a block, the operating point does not need to contain a node corresponding to that block. Use the hasPath function to determine whether the operating point contains data at the specified location.

Open the Permanent Magnet DC Motor example model and create an OperatingPoint object named op using the Start values from the model:

op = simscape.op.create(gcs, 'Start')
op = 

  OperatingPoint with children:
   DC Motor
   DC Voltage
   Load Torque
   MRRef Motor
   MRRef Torque

Open the DC Motor subsystem, select the Inductor block, and find the relative path to this block in the operating point data hierarchy:

 relPath = relativePath(op, gcb)
relPath =

    'DC Motor/Rotor Inductance'

Now determine whether the operating point contains data for this block:

 hasPath(op, relPath)
ans =



Input Arguments

collapse all

Operating point in the workspace, specified as an OperatingPoint object.

Relative path in the operating point data tree, specified as a slash-delimited character vector or string scalar. Use the relativePath function to determine the path to an element. The element can be a subsystem, block, or variable target.

Data Types: char | string

Introduced in R2017b