set_param
Set Simulink parameter value
Description
set_param(
sets the specified Simulink® parameter object,parameter1,value1,...,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 -nodisplayto start a session, you cannot useset_paramto run a simulation. The-nodisplaymode does not support simulation usingset_param. Use thesimfunction instead.When you use the
set_paramfunction 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