The ability to add custom parameters to built-in blocks is not available in Simulink 7.8 (R2011b). To work around this issue, starting in Simulink 7.8 (R2011b) it is possible to mask built-in blocks which do not already have a mask. This may be done by right-clicking on the block and choosing 'Create Mask'. Within the Mask Editor dialog, block parameters may be added to the block that are accessible via the functions GET_PARAM and SET_PARAM.
In versions before Simulink 7.8 (R2011b), the block parameter 'UserData' may be used to store the desired values. Also, the parameter 'UserDataPersistent' may be set to 'on' in order to save the data stored in 'UserData' in the model file. For example:
set_param('myModel/gain1', 'UserData', myData)
set_param('myModel/gain1', 'UserDataPersistent', 'on')
would save the value 'myData' in 'UserData' and specify that it should be stored in the MDL file after the model is saved and closed.
Best Answer