| Contents | Index |
InputRealPtrsType ssGetInputPortRealSignalPtrs(SimStruct *S, int_T port)
Pointers to the elements of a signal of type double connected to the input port specified by the index port.
This macro returns a pointer to an array of pointers to the real_T input signal elements. The length of the array of pointers is equal to the width of the input port. The input port index starts at 0 and ends at the number of input ports minus 1.
Note The ssGetInputPortRealSignalPtrs macro becomes a function when you compile your S-function in debug mode (mex -g). |
C, C++
The following example reads all input port signals.
int_T i,j;
int_T nInputPorts = ssGetNumInputPorts(S);
for (i = 0; i < nInputPorts; i++) {
InputRealPtrsType uPtrs =
ssGetInputPortRealSignalPtrs(S,i);
int_T nu = ssGetInputPortWidth(S,i);
for (j = 0; j < nu; j++) {
SomeFunctionToUseInputSignalElement(*uPtrs[j]);
}
}
See the S-function sfun_atol.c used in sfcndemo_sfun_atol.mdl for a complete example using this function.
ssGetInputPortWidth, ssGetInputPortDataType, ssGetInputPortSignalPtrs

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |