File Exchange

image thumbnail

Vectorized set_param

version (2.91 KB) by

Set multiple Simulink® systems and block parameters in a single call.



View License

Are you like me and finding yourself wanting to change the parameters of multiple Simulink objects at once? Do you run find_system only to then take the output and use it in a for loop that calls set_param? Are you tired of your for loop crashing because a block name has a carriage return or an apostrophe? Well if this is you, I have a simple utility that can make life easier.
SET_PARAMS(OBJECTS,'PARAMETER1',VALUE1,'PARAMETER2',VALUE2,...) is a vectorized form of SET_PARAM that works with cellstrs. It sets parameters within OBJECTS to the specified values. This enables the user to change multiple objects in a single call, work directly with output from find_system, and easily work with blocks that contain carriage returns and/or apostrophes.

set_params({'model/block1' 'model/subsystem1/block2'},'FontName','Courier New')
will change block1 and block2 to use Courier New as their font

will set the background color of all Scopes in the current Simulink model to light blue.

Comments and Ratings (0)


Updated license


rephrased title


Updated copyright for 2010

MATLAB Release
MATLAB 7.9 (R2009b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video