mdlGetOperatingPoint

Return C MEX S-function's simulation operating point as a MATLAB data structure

Required

No

Languages

C, C++

Syntax

mxArray* mdlGetOperatingPoint(SimStruct* S)

Arguments

S

SimStruct representing an S-Function block.

Description

The Simulink® engine invokes this custom method to get the simulation operating point (snapshot) of the model containing S. A call to this method occurs after mdlStart and before mdlTerminate to ensure that all of the S-function data structures (states, DWork vectors, and outputs) are available. mdlGetOperatingPoint is required when the operating point compliance is custom,

Example

/* 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;
}

Introduced in R2019a