Writing S-Functions | ![]() ![]() |
Get the address of a real, contiguous signal entering an input port.
Syntax
const real_T *ssGetInputPortRealSignal(SimStruct *S, inputPortIdx)
Arguments
S
SimStruct representing an S-function block.
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 mdlIntializeSizes
has specified that the elements of the input signal be contiguous, using ssSetInputPortRequiredContiguous
.
Languages
Example
The following code demonstrates the use of ssGetInputPortRealSignal
.
nInputPorts = ssGetNumInputPorts(S); for (i = 0; i < nInputPorts; i++) { int_T nu = ssGetInputPortWidth(S,i); if ( ssGetInputPortRequiredContiguous(S,i) ) { const real_T *u = ssGetInputPortRealSignal(S,i); UseInputVectorInSomeFunction(u, nu); } else { InputPtrsType u = ssGetInputPortSignalPtrs(S,i); for (j = 0; j < nu; j++) { UseInputInSomeFunction(*u[j]); } } }
See Also
ssSetInputPortRequiredContiguous, ssGetInputPortSignal, mdlInitializeSizes
![]() | ssGetInputPortOverWritable | ssGetInputPortRealSignalPtrs | ![]() |