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.

sltest.testsequence.readSymbol

Read Test Sequence block symbol properties

Syntax

symbolInfo = sltest.testsequence.readSymbol(blockPath,symbol)
symbolInfo = sltest.testsequence.readSymbol(blockPath,symbol,Property)

Description

symbolInfo = sltest.testsequence.readSymbol(blockPath,symbol) returns a struct symbolInfo of properties for symbol in the Test Sequence block specified by blockPath.

symbolInfo = sltest.testsequence.readSymbol(blockPath,symbol,Property) returns the value symbolInfo of the Property for symbol.

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 = 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 character vector.

Example: 'FanSpeedTestHarness/Test Sequence'

Test Sequence block symbol name, specified as a character vector. Symbols include data, messages, function calls, and triggers used as inputs, outputs, local variables, constants, parameters, or data store memory in the Test Sequence block.

Example: 'DurationLimit'

Test Sequence block symbol property, specified as a character vector. To find valid properties for a particular symbol, read properties of the symbol using sltest.testsequence.readSymbol(blockPath,symbol).

Example: 'Kind'

Example: 'Scope'

Example: 'DataType''Description'

Output Arguments

collapse all

Properties of the Test Sequence block symbol.

Example: struct

Introduced in R2017a