Main Content

sltest.testsequence.setProperty

Set Test Sequence block properties

Description

example

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, are writable. You cannot change the value of ActiveStepDataSymbol using sltest.testsequence.setProperty. You can, however, rename the symbol using sltest.testsequence.editSymbol.

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: ''
            ScenarioParameter: ''

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: ''
            ScenarioParameter: ''

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. 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: 0
         ActiveStepDataSymbol: ''
            ScenarioParameter: ''

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.

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 quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

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

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

Introduced in R2017a