ssGetInputPortSignalPtrs
Get pointers to an input port's signal elements
Syntax
InputPtrsType ssGetInputPortSignalPtrs(SimStruct *S, int_T port)
Arguments
-
S
-
SimStruct representing an S-Function block.
-
port
-
Index of an input port.
Returns
Pointer to an array of signal element pointers for the specified input port.
Description
Use to obtain pointers to an input port's signal elements. If the input port width is 5, this function returns a pointer to a 5-element pointer array. Each element in the pointer array points to the specific element of the input signal.
You must usessGetInputPortRealSignalPtrs
to get pointers to signals of typedouble
(real_T
).
Use this function only for non-contiguous input. If you have contiguous input, use thessGetInputPortSignal
function.
Note
ThessGetInputPortSignalPtrs
宏成为一个功能当你编译自动送料unction in debug mode (mex -g
).
Languages
C, C++
Example
Assume that the input port data types areint8_T
.
int_T nInputPorts = ssGetNumInputPorts(S); for (i = 0; i < nInputPorts; i++) { InputPtrsType u = ssGetInputPortSignalPtrs(S,i); InputInt8PtrsType uPtrs = (InputInt8PtrsType)u; int_T nu = ssGetInputPortWidth(S,i); for (j = 0; j < nu; j++) { /* uPtrs[j] is an int8_T pointer that points to the j-th element of the input signal. */ UseInputInSomeFunction(*uPtrs[j]); }
See the S-functionsfun_dtype_io.c
used insfcndemo_dtype_io
for a complete example that uses this function.