Main Content

sltest.testsequence.editSymbol

Edit symbol in Test Sequence block

Description

sltest.testsequence.editSymbol(blockPath,name,Name,Value) edits a symbol name with properties specified by Name,Value in a Test Sequence block specified by blockPath. Symbols include data, function calls, messages, 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.

Model = 'sltestRollRefTestExample';
load_system(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 = 1x1 cell array
    {'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 string or character vector. Instead of the block path, you can use a block handle.

Example: 'FanSpeedTestHarness/Test Sequence'

Name of the symbol, specified as a character vector. For the symbol that controls the active scenario, you can change only its name using the 'Name' name-value pair.

Example: 'theta'

Name-Value Pair Arguments

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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Find valid name-value pairs by applying sltest.testsequence.readSymbol to the existing symbol.

Example: 'DataType,'single','Scope','Constant'

Version History

Introduced in R2017a