| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
set_param(object, paramName1, Value1,
..., paramNameN, ValueN)
set_param(object, paramName1, Value1, ..., paramNameN, ValueN) sets the specified parameter(s) to the specified value(s). Case is ignored for parameter names. Value strings are case-sensitive.
Most block parameter values must be specified as strings. Two exceptions are the Position and UserData parameters, which are common to all blocks. All parameters that correspond to dialog box entries have string values.
To change block parameter values in the workspace and then update the block diagram with the changes:
Use set_param to make the changes at the command prompt.
Make the model window the current window.
When you set multiple parameters on the same model or block, use a single set_param command with multiple pairs of arguments, rather than multiple set_param commands. This technique is more efficient because using a single call requires evaluating parameters only once, and more robust because it prevents dependency errors by setting all parameter values before checking the legality of the results.
object |
The model or block for which set_param is to set one or more parameter values. |
paramName1, Value1 ... |
One or more pairs, each consisting of a parameter name and a value to which set_param is to set that parameter in object. |
Set the Solver and StopTime parameters of the vdp system:
set_param('vdp', 'Solver', 'ode15s', 'StopTime', '3000')
Set the Gain parameter of the Mu block in the vdp system to 1000:
set_param('vdp/Mu', 'Gain', '1000')
Set the position of the Fcn block in the vdp system:
set_param('vdp/Fcn', 'Position', [50 100 110 120])
Set the Zeros and Poles parameters for the Zero-Pole block in the mymodel system:
set_param('mymodel/Zero-Pole','Zeros','[2 4]','Poles','[1 2 3]')
Set the Gain parameter k for a block in a masked subsystem.
set_param('mymodel/Subsystem', 'k', '10')
Set the OpenFcn callback parameter of the block named Compute in system mymodel.
set_param('mymodel/Compute', 'OpenFcn', 'my_open_fcn')
find_system | gcb | get_param
![]() | save_system | setActiveConfigSet | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |