mdlGetOperatingPoint
Return operating point for C MEX S-function as MATLAB data structure
Required
No
Languages
C, C++
Syntax
mxArray* mdlGetOperatingPoint(SimStruct* S)
Arguments
S
SimStruct that represents an S-Function block.
Description
The Simulink® engine invokes this custom method to get the operating point for the
S-function when saving the model operating point for the model that uses the S-function. The
software saves the model operating point when you explicitly configure a model to save final
states with the final operating point and when you use features that rely on the model
operating point internally, such as fast restart. The software invokes this method after
mdlStart
and before mdlTerminate
to ensure that all
the S-function data structures, such as the states, DWork vectors, and outputs, are
initialized.
You must implement this method when you specify custom operating point compliance
(USE_CUSTOM_OPERATING_POINT
) using ssSetOperatingPointCompliance
.
Examples
/* Function: mdlGetOperatingPoint * Abstract: * Package the RunTimeData structure as a MATLAB structure * and return it. */ static mxArray* mdlGetOperatingPoint(SimStruct* S) { RunTimeData_T* rtd = (RunTimeData_T*)ssGetPWorkValue(S, 0); const char* fieldNames[] = {"Count"}; /* Create a MATLAB structure to hold the run-time data */ mxArray* simSnap = mxCreateStructMatrix(1, 1, 1, fieldNames); mxSetField(simSnap, 0, fieldNames[0], mxCreateDoubleScalar(rtd->cnt)); return simSnap; }