Code covered by the BSD License  

Highlights from
Vectorized set_param

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 2.91 KB File ID: #26271

Vectorized set_param

by Will Campbell

 

04 Jan 2010 (Updated 22 Feb 2010)

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

| Watch this File

File Information
Description

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.

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

set_params(find_system(bdroot,'BlockType','Scope'),'BackgroundColor','lightBlue')
  will set the background color of all Scopes in the current Simulink model to light blue.

Required Products Simulink
MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
06 Jan 2010

Updated copyright for 2010

22 Feb 2010

rephrased title

Tag Activity for this File
Tag Applied By Date/Time
simulink Will Campbell 06 Jan 2010 12:28:58
utilities Will Campbell 06 Jan 2010 12:28:58

Contact us at files@mathworks.com