This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Get the current simulation time


time_T ssGetT(SimStruct *S)



SimStruct representing an S-Function block.


A value of type time_T indicating the current simulation time.


Use to determine the current base simulation time (time_T) for the model. You can use this macro in mdlOutputs and mdlUpdate to compute the output of your block. See matlabroot/extern/include/tmwtypes.h for a description of the time_T data type.


Use this macro only if your block operates at the base rate of the model, for example, if your block operates at a single continuous rate. If your block operates at multiple rates or operates at a single rate that is different from the model's base, use ssGetTaskTime to get the correct time for the current task.


If the S-Function is operating in continuous sample time, ssGetT may return non-monotonic times due to solver operation. A monotonic time vector can only be guaranteed at major time steps. Therefore, if such a time vector is required, consider using ssGetT with ssIsMajorTimeStep.


C, C++


See the S-function vsfunc.c used in sfcndemo_vsfunc.

Introduced before R2006a