Get pointers to an input port's signal elements
InputPtrsType ssGetInputPortSignalPtrs(SimStruct *S, int_T port)
S
SimStruct representing an S-Function block.
port
Index of an input port.
Pointer to an array of signal element pointers for the specified input port.
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 use ssGetInputPortRealSignalPtrs
to get pointers to
signals of type double
(real_T
).
Use this function only for non-contiguous input. If you have contiguous input, use
the ssGetInputPortSignal
function.
The ssGetInputPortSignalPtrs
macro becomes a function when
you compile your S-function in debug mode (mex -g
).
C, C++
Assume that the input port data types are int8_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-function sfun_dtype_io.c
used in sfcndemo_dtype_io
for a complete example that uses this
function.