This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Specify reusability of the memory allocated to the input port of an S-function


void ssSetInputPortOptimOpts(SimStruct *S, int_T port, uint_T val)



SimStruct representing an S-Function block.


Index of an input port of S.


Reusability of port. Permissible values are






Use this macro to specify the reusability and scope of the memory allocated to an S-function input port. The reusability indicates if the memory associated with the input port can be overwritten, or not. You must indicate an input port is reusable if you use the ssSetInputPortOverWritable macro to specify the input port's memory can be overwritten by one of the output ports.

The Simulink® engine disregards the memory scope setting, instead treating all S-function ports as global during simulation.

    Note:   The Simulink Coder™ product uses the memory scope setting you specified when generating code from a model. The Simulink Coder product attempts to declare local variables for any inputs with a local scope. If your S-function uses the inputs in a way that precludes using a local scope, the generated code uses global variables for the inputs. See S-Functions for Multirate Multitasking Environments (Simulink Coder) and S-Functions That Specify Port Scope and Reusability (Simulink Coder) for more information.


C, C++


See the S-function sfun_multirate.c used in sfcndemo_sfun_multirate and the S-function sdotproduct.c used in sfcndemo_sdotproduct.

Introduced before R2006a

Was this topic helpful?