set_param
Set system and block parameter values
Description
set_param(
sets the parameter to the specified value on the specified model or block
object.Object
,ParameterName
,Value
,...ParameterNameN,ValueN)
When you set multiple parameters on the same model or block,
use a single set_param
command with multiple pairs
of ParameterName
, Value
arguments,
rather than multiple set_param
commands. This technique
is efficient because using a single call requires evaluating parameters
only once. If any parameter names or values are invalid, then the
function doesn’t set any parameters.
Tips:
If you make multiple calls to
set_param
for the same block, then specifying the block using a numeric handle is more efficient than using the full block path. UsegetSimulinkBlockHandle
to get a block handle.If you use
matlab -nodisplay
to start a session, you cannot useset_param
to run your simulation. The-nodisplay
mode does not support simulation usingset_param
. Use thesim
command instead.After you set parameters in the MATLAB® workspace, to see the changes in a model, update the diagram.
set_param(model,'SimulationCommand','Update')
For parameter names, see: