Main Content

sltest.harness.find

R2026b

Find test harnesses in model

Description

harnessList = sltest.harness.find(harnessOwner) returns a structure listing harnesses and harness properties that exist for the component or model harnessOwner.

harnessList = sltest.harness.find(harnessOwner,Name=Value) uses additional search options specified by one or more Name=Value arguments.

example

Examples

collapse all

Find harnesses for the f14 model and its first-level subsystems. The function matches harness names according to a regular expression.

openExample('f14');
sltest.harness.create('f14',Name='model_harness');
sltest.harness.create('f14/Controller',Name=...
   'Controller_Harness1');
harnessList = sltest.harness.find('f14',...
   SearchDepth=1,Name='_[Hh]arnes+',...
   RegExp=on)
harnessList = 

1x2 struct array with fields:

    model
    name
    description
    type
    ownerHandle
    ownerFullPath
    ownerType
    isOpen
    canBeOpened
    verificationMode
    saveExternally
    rebuildOnOpen
    rebuildModelData
    graphical
    origSrc
    origSink

Input Arguments

collapse all

Model or component handle or path, specified as a character vector or double

Example: 1.9500e+03

Example: 'model_name'

Example: 'model_name/Subsystem'

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: SearchDepth=2,Name='controller_harness' searches the model or component, and two lower hierarchy levels, for harnesses named controller_harness.

Harness name to search for in the model, specified as the name-value argument consisting of Name and a character vector or a regular expression. You can specify a regular expression only if you also use the Name=Value argument RegExp=on.

Example: Name='sample_harness'Name='_[Hh]arnes+'

Ability to search using a regular expression, specified as the name-value argument consisting of RegExp and "off" or "on". When RegExp is set to on, you can use a regular expression with Name.

Example: RegExp="on"

Subsystem levels into harnessOwner to search for harnesses, specified as the name-value argument consisting of SearchDepth and an integer. For example:

0 searches harnessOwner.

1 searches harnessOwner and its subsystems.

2 searches harnessOwner, its subsystems, and their subsystems.

When you do not specify SearchDepth, the function searches all levels of harnessOwner.

Example: SearchDepth=1

Search option to return only open or loaded harnesses, specified as the name-value argument consisting of OpenOnly and off or on.

Example: OpenOnly=on

Name of the function interface for the reusable library subsystem to search for, specified as a string or character vector. Using this Name-Value argument returns a list of all harnesses for the specified function interface.

Example: FunctionInterfaceName='double_RLS'

Output Arguments

collapse all

List of harnesses and properties for the component or model harnessOwner, returned as a structure. The structure fields are shown in the Use RegExp to Find Harnesses for a Model Component example.

Version History

Introduced in R2015a