Open the Property Inspector. Select View > Property Inspector.
Select the block whose callback you want to specify. In the Properties tab of the Property Inspector, in the Callbacks section, select the callback you want to define.
In the box, enter the functions you want the callback to perform.
To specify a block callback programmatically, use
set_param to assign MATLAB® code
to the block callback parameter.
If a block callback executes before or after a modeling action takes place, that callback occurs immediately before or after the action.