set_param
Set Simulink parameter value
Description
set_param(
sets the specified Simulink® parameter object
,parameter
1,value
1,...,parameterN,valueN)parameter
to the specified value
value
for the target object specified by
object
. The target object can be a model, subsystem,
library, block, line, port, or bus element port element.
To set multiple parameter values for the target object, call the
set_param
function once with multiple name-value arguments
instead of separately calling the function for each parameter. Setting multiple
parameters with one function call is efficient because one call evaluates the
parameters only once. If any parameter names or values are invalid, then the
function does not set any parameters.
Examples
Input Arguments
Limitations
If you use
matlab -nodisplay
to start a session, you cannot useset_param
to run a simulation. The-nodisplay
mode does not support simulation usingset_param
. Use thesim
function instead.When you use the
set_param
function to rename a block or signal, these names are not valid: empty names, names that contain only newline characters, and names that begin or end with/
.
Tips
After you set parameters in the MATLAB workspace, to see the changes in a model, update the diagram.
set_param(model,'SimulationCommand','Update')
Version History
Introduced before R2006a
See Also
Functions
get_param
|getSimulinkBlockHandle
|gcs
|gcb
|bdroot
|open_system
|new_system