Main Content

sltest.testsequence.setProperty

Set Test Sequence block properties

Description

sltest.testsequence.setProperty(blockPath,Name,Value) sets properties of the Test Sequence block specified by blockPath according to one or more Name, Value pairs. Obtain valid properties using sltest.testsequence.getProperty.

Note

All properties, except ActiveStepDataSymbol and ScenarioParameter, are writable. You cannot change the value of ActiveStepDataSymbol or ScenarioParameter using sltest.testsequence.setProperty. You can, however, rename the symbols using sltest.testsequence.editSymbol.

example

Examples

collapse all

This example shows how to create a Test Sequence block programmatically, and get properties for the block, which can be used in Name, Value pairs for sltest.testsequence.setProperty.

1. Create a model and a Test Sequence block.

new_system('tsb_model');
sltest.testsequence.newBlock('tsb_model/Test Sequence');

2. Get properties of the Test Sequence block.

block_properties = sltest.testsequence.getProperty...
    ('tsb_model/Test Sequence')
block_properties = 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: 'String'
            ScenarioParameter: ''
                    Semantics: 'StateflowCompatible'

3. Close the model.

close_system('tsb_model',0)

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

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

ts = sltest.testsequence.getProperty(...
     'model/Test Sequence');
sltest.testsequence.editSymbol(...
     'model/Test Sequence',...
     ts.ActiveStepDataSymbol,...
     'ActiveStepEnumName','NewEnumName')

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-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.

Example: 'Description','Temperature cycle','EnableActiveStepData',true

Valid name-value pairs are block-specific. Obtain properties for the block using sltest.testsequence.getProperty.

Version History

Introduced in R2017a