title: Script to replace variables used in simulink blocks with a value
body: <p>Is there a way to replace variables used in a Simulink block with actual values stored in the Matlab base workspace (or model workspace) ?</p>
  
  <p>e.g.
  In a gain block, the 'Gain' parameter is set to 'gain_A'.
  'gain_A' is defined in the base workspace to '0.5'.
  Intended script will replace 'gain_A' in the gain block with'0.5'.</p>
  
  <p>A method that I've tried is to use <code>Simulink.findVars(modelname, 'Name', 'gain_A')</code> which will return an object that contains a property with all the blocks that uses the variable 'gain_A'. However, it doesn't tell me which parameter it is used for (e.g. 'Gain').</p>
  
  <p>Appreciate your help =)</p>