Set system and block parameter values
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. Use getSimulinkBlockHandle
to
get a block handle.
If you use matlab -nodisplay
to
start a session, you cannot use set_param
to run
your simulation. The -nodisplay
mode does not support
simulation using set_param
. Use the sim
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:
bdroot
| gcb
| gcs
| get_param
| getSimulinkBlockHandle
| new_system
| open_system