Main Content

sltest.testsequence.getProperty

Get Test Sequence block properties

Description

blockInfo = sltest.testsequence.getProperty(blockPath) returns a blockInfo structure containing properties of the Test Sequence block specified by blockPath.

blockInfo = sltest.testsequence.getProperty(blockPath,propertyName) returns blockInfo, containing the value of propertyName.

Examples

collapse all

This example gets and sets properties for a Test Sequence block using the programmatic interface.

1. Load the model.

Model = 'sltestRollRefTestExample';
load_system(Model)

2. Get properties of the Test Sequence block.

blockInfo = sltest.testsequence.getProperty([Model '/Test Sequence'])
blockInfo = struct with fields:
                         Name: 'Test Sequence'
                 UpdateMethod: 'INHERITED'
                   SampleTime: '-1'
                  Description: ''
                     Document: ''
                          Tag: []
        SupportVariableSizing: 1
    SaturateOnIntegerOverflow: 1
                  InputFimath: 'fimath(......'
             EmlDefaultFimath: 'Same as MATLAB Default'
         EnableActiveStepData: 0
         ActiveStepDataSymbol: ''
           ActiveStepDataType: 'Enum'
            ScenarioParameter: ''
                    Semantics: 'StateflowCompatible'

3. Get the Test Sequence block update method.

blockUpdateMethod = sltest.testsequence.getProperty(...
    [Model '/Test Sequence'],'UpdateMethod')
blockUpdateMethod = 
'INHERITED'

4. Change the Test Sequence block update method and sample time.

sltest.testsequence.setProperty([Model '/Test Sequence'],...
    'UpdateMethod','Discrete','SampleTime','0.1')

5. Enable active step data and set the data type to String. Use this data type if you have duplicate step names in a single test sequence or across scenarios in the Test Sequence block.

sltest.testsequence.setProperty([Model '/Test Sequence'],...
    'EnableActiveStepData',1,'ActiveStepDataType','String');

6. Check the changes.

blockInfo = sltest.testsequence.getProperty([Model '/Test Sequence'])
blockInfo = struct with fields:
                         Name: 'Test Sequence'
                 UpdateMethod: 'DISCRETE'
                   SampleTime: '0.1'
                  Description: ''
                     Document: ''
                          Tag: []
        SupportVariableSizing: 1
    SaturateOnIntegerOverflow: 1
                  InputFimath: 'fimath(......'
             EmlDefaultFimath: 'Same as MATLAB Default'
         EnableActiveStepData: 1
         ActiveStepDataSymbol: 'Active_Step'
           ActiveStepDataType: 'String'
            ScenarioParameter: ''
                    Semantics: 'StateflowCompatible'

7. Close the model.

close_system(Model,0)

The ActiveStepEnumName is a property of the ActiveStepDataSymbol, which is a property of the Test Sequence block. To obtain the enumeration name of the active step, use this code:

ts = sltest.testsequence.getProperty(...
     'model/Test Sequence');
actstep = sltest.testsequence.readSymbol(...
     'model/Test Sequence',ts.ActiveStepDataSymbol);
enum_name = actstep.ActiveStepEnumName

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 a particular Test Sequence block property for which to get a value.

Example: 'Description'

Output Arguments

collapse all

Output of block properties, or the value of a particular block property

Example: struct with fields

Example: char array

Example: logical

Version History

Introduced in R2017a