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 faster because one call evaluates the
parameters only once. If any parameter names or values are invalid, then the
function does not set any parameters.
To programmatically interact with a simulation, use the set_param
function with the SimulationCommand name-value argument. For more
information, on the page Run Simulations Programmatically, see the section Interact with Simulations by Issuing Simulation Commands.
For most parameters, running set_param regardless of whether
the specified value is different from the current value is faster than comparing the
values and only running the function if the values differ.
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/.
Version History
Introduced before R2006a
See Also
Functions
get_param|getSimulinkBlockHandle|gcs|gcb|bdroot|open_system|new_system