Based on the comments in response to Benjamin's answer, here is the complete and concise answer to the question:
- First create a mask for the block. Right click on the block and select Mask > Edit Mask.
- Add the parameters you want to the mask in the Parameters & Dialog tab, in my case just one parameter called 'obs':
3. Now you can use these parameters in the Icon & Ports script. For example:
4. And when the user double-clicks on the block they will be able to specify the parameters:
4. Finally, right click on the block and select Mask > Look Under Mask. Now add the parameters you want to pass to the S-function as a list of comma-separated names. In my case, just the one parameter 'obs':
Presumably, now the 'obs' reference is to the block's own parameter rather than an object in the MATLAB workspace as it would have been before you defined 'obs' in step 2 above.
5. These parameter(s) will now be accessible to the S-function in the usual way. For example:
% Get observer struct
obs = block.DialogPrm(1).Data;