Documentation

sltest.testsequence.findSymbol

Find Test Sequence block symbols

Syntax

symbols = sltest.testsequence.findSymbol(blockPath,Name,Value)

Description

symbols = sltest.testsequence.findSymbol(blockPath,Name,Value) returns symbols in the Test Sequence block blockPath matching properties specified by Name,Value pairs. Symbols include data, messages, function calls, and triggers.

Examples

collapse all

This example edits constant DurationLimit in the Test Sequence block, changing it to a local variable of single data type.

1. Load the model.

cd(matlabroot)
Model = 'sltestRollRefTestExample';
load_system(fullfile(matlabroot,'examples','simulinktest',Model))

2. Search for data symbols containing the word duration.

data_names = sltest.testsequence.findSymbol...
    ('sltestRollRefTestExample/Test Sequence','Name','[Dd]uration',...
    'RegExp','on','Kind','Data')
data_names =

  cell

    'DurationLimit'

3. Read the properties of the DurationLimit constant.

dlProperties = sltest.testsequence.readSymbol...
    ('sltestRollRefTestExample/Test Sequence',data_names{1})
dlProperties = 

  struct with fields:

            Kind: 'Data'
           Scope: 'Constant'
        DataType: 'double'
     Description: ''
        Document: ''
    InitialValue: '5'
            Name: 'DurationLimit'
            Size: ''
             Tag: []

4. Change DurationLimit to a local variable of single data type.

sltest.testsequence.editSymbol('sltestRollRefTestExample/Test Sequence',...
    data_names{1},'Scope','Local','DataType','single')

5. Close the model.

close_system(Model,0)

Input Arguments

collapse all

Path to a Test Sequence block, including the block name, specified as a character vector.

Example: 'FanSpeedTestHarness/Test Sequence'

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Kind','Message','Scope','Output'Example: 'Kind','Data','Name','[Aa]ngle','RegExp','on'

collapse all

The scope defines how the data symbol operates in the block. It is specified as a character vector.

Example: 'Data'

Data symbol scope, specified as a character vector.

Example: 'Parameter'

The name of the test steps to search

Example: 'Name','Engage'

Example: 'Name','[Aa][Pp][Ee]ng'

Specifies case

Example: 'CaseSensitive','on'

Specify whether to search the step names using Name as a regular expression

Example:

'RegExp','on'

Output Arguments

collapse all

Cell array of Test Sequence block symbols matching search criteria

Example: cell

Introduced in R2017a

Was this topic helpful?