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.


Get the address of a real, contiguous signal entering an input port


const real_T *ssGetInputPortRealSignal(SimStruct *S, int_T inputPortIdx)



SimStruct representing an S-Function block.


Index of the port whose signal is required.


A pointer (real_T *) to a real signal on the input port specified by the index inputPortIdx.


Use to obtain the real signal on a particular input port. A method should use this macro only if the input signal is known to be real and mdlInitializeSizes has specified that the elements of the input signal be contiguous, using ssSetInputPortRequiredContiguous.

    Note   The ssGetInputPortRealSignal macro becomes a function when you compile your S-function in debug mode (mex -g).


C, C++


The following code demonstrates the use of ssGetInputPortRealSignal.

Set flags to require that the input ports be contiguous:

void mdlInitializeSizes(SimStruct* S) {
	int_T i;
	/* snip */
	if (!ssSetNumInputPorts(S,2)) return;
		for (i = 0; i < 2; i++) {
        	/* snip */
                /* snip */

You can now use ssGetInputPortRealSignal in mdlOutputs:

void mdlOutputs(SimStruct* S, int_T tid) {
	int_T i;
	/* snip */

	for (i = 0; i < 2; i++) {
			 int_T nu = ssGetInputPortWidth(S,i);
 			const real_T* u  = ssGetInputPortRealSignal(S,i);
			 UseInputVectorInSomeFunction(u, nu);
		/* snip */

See the S-function sfun_frmdft.c used in sfcndemo_frame for a complete example using this function. Running this model requires a DSP System Toolbox™ license.

Introduced before R2006a

Was this topic helpful?