hasPath

Determine whether operating point data contains element at specified path

Syntax

hasPath(op,opPath)

Description

example

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.

Examples

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:

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

  OperatingPoint with children:
  -----------------------------
   DC Motor
   DC Voltage
   ERef
   Load Torque
   MRRef Motor
   MRRef Torque
   Sensing
  -----------------------------

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 =

  logical

   1

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