Main Content

set

Set a parameter value in a ParameterSet object

    Description

    example

    set(parameter_set,block_path,parameter_name,parameter_value) provides a programmatic approach that performs the same operation as editing the value in the Parameter Explorer. For more information, see explorer.

    Examples

    collapse all

    To set a parameter value in the ParameterSet object, use the set command.

    set(myParamSet,'slrt_ex_osc_outport/Signal Generator/Amplitude',2);

    Input Arguments

    collapse all

    The ParameterSet object that was created from the real-time application in the importParamSet command.

    Example: myParamSet

    The block_path values can be:

    • Empty character vector ('') or empty string scalar ("") for base or model workspace variables

    • Character vector or string scalar string for block path to parameters in the top model

    • Cell array of character vectors or string scalars for model block arguments

    Example: '', 'Gain1', {'top/model','sub/model'}

    The parameter can designate either a block parameter or a global parameter that provides the value for a block parameter. The block parameter or MATLAB® variable must be observable to be accessible through the parameter name.

    Note

    Simulink® Real-Time™ does not support parameters of multiword data types.

    Example: 'Gain', 'oscp.G1', 'oscp', 'G2'

    The value of the parameter.

    Introduced in R2021a