Main Content

add_param

Add parameter to Simulink model

Description

add_param(sys,param1,val1,...,paramN,valN) adds the specified parameters to the specified model and initializes the parameters to the specified values. The parameters are saved in the corresponding SLX or MDL file. You can use the set_param and get_param functions on the parameters.

example

Examples

collapse all

Open the example. Then, load the vdp model.

load_system('vdp')

Add the parameters DemoName and EquationOrder to the model with the values 'VanDerPolEquation' and '2', respectively.

add_param('vdp','DemoName','VanDerPolEquation','EquationOrder','2')

Use the get_param function to query the values of the new parameters.

get_param('vdp','DemoName')
ans = 
'VanDerPolEquation'
get_param('vdp','EquationOrder')
ans = 
'2'

Input Arguments

collapse all

Model name or handle, specified as a character vector, string scalar, or numeric scalar. The model must be an SLX or MDL file.

Data Types: double | char | string

Name of parameter, specified as a character vector or string scalar.

Parameter names are case insensitive. For example, 'ParameterName' is equivalent to 'parametername'.

You cannot add a parameter that has the same name as an existing parameter of the model.

Dependencies

To use this parameter, specify a corresponding val1 argument.

Data Types: char | string

Initial value of parameter, specified as a character vector or string scalar.

Values are case sensitive.

Dependencies

To use this parameter, specify a corresponding param1 argument.

Data Types: char | string

Version History

Introduced before R2006a