add_param
Add parameter to Simulink model
Description
Examples
Add Parameters to Model
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
sys
— System name or handle
character vector | string scalar | numeric scalar
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
paramN
— Name of parameter
character vector | string scalar
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
valN
— Initial value of parameter
character vector | string scalar
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
See Also
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)