| Writing S-Functions | ![]() |
Get the address of a contiguous signal entering an input port.
Syntax
Arguments
S
SimStruct representing an S-Function block.
inputPortIdx
Index of port whose sample time is required.
Description
Returns the address of the specified input port. A method should use this macro only if mdlInitializeSizes has specified that the elements of the input signal be contiguous, using ssSetInputPortRequiredContiguous.
Languages
Example
The following code demonstrates the use of ssGetInputPortSignal.
nInputPorts = ssGetNumInputPorts(S); for (i = 0; i < nInputPorts; i++) { int_T nu = ssGetInputPortWidth(S,i); if ( ssGetInputPortRequiredContiguous(S,i) ) { const void *u = ssGetInputPortSignal(S,i); UseInputVectorInSomeFunction(u, nu); } else { InputPtrsType u = ssGetInputPortSignalPtrs(S,i); for (j = 0; j < nu; j++) { UseInputInSomeFunction(*u[j]); } } }
If you know that the inputs are always real_T signals, the ssGetInputPortSignal line in the above code snippet would be
See Also
ssSetInputPortRequiredContiguous, ssGetInputPortRealSignal
| ssGetInputPortSampleTimeIndex | ssGetInputPortSignalAddress | ![]() |