| Contents | Index |
No
#define MDL_SIM_STATE
mxArray* mdlSetSimState(SimStruct* S)
GetSimState(s)
Instance of Simulink.MSFcnRunTimeBlock class representing the Level-2 MATLAB S-Function block.
The Simulink engine invokes this custom method to get the simulation state (SimState) of the model containing S. A call to this method should occur after mdlStart and before mdlTerminate to ensure that all of the S-function data structures (e.g., states, DWork vectors, and outputs) are available.
% Function: mdlGetSimState
% Abstract:
% Package the RunTimeData structure as a MATLAB structure
% and return it.
%
static mxArray* mdlGetSimState(SimStruct* S)
{
int n = ssGetInputPortWidth(S, 0);
RunTimeData_T* rtd =
(RunTimeData_T*)ssGetPWorkValue(S, 0);
/* Create a MATLAB structure to hold the run-time data */
mxArray* simSnap =
mxCreateStructMatrix(1, 1, nFields, fieldNames);
return simSnap;
}C, C++, MATLAB

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 |