Writing S-Functions | ![]() ![]() |
Get the address of a real, contiguous signal entering an input port.
Syntax
Arguments
S
SimStruct representing an S-Function block.
inputPortIdx
Index of the port whose sample time is required.
Description
Returns the address of a real signal on the specified 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
.
Languages
Example
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 */ ssSetInputPortDirectFeedThrough(S,i,1); ssSetInputPortRequiredContiguous(S,i,1); } /* 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);
See Also
ssSetInputPortRequiredContiguous, ssGetInputPortSignal, mdlInitializeSizes
![]() | ssGetInputPortOverWritable | ssGetInputPortRealSignalPtrs | ![]() |