| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
time_T ssGetTaskTime(SimStruct *S, st_index)
SimStruct representing an S-Function block.
Index of the sample time corresponding to the task for which the current time is to be returned.
A value of type time_T.
Use to determine the current time (time_T) of the task corresponding to the sample rate specified by st_index. 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.
The ssGetTaskTime macro should be called only inside an ssIsSampleHit check. It will not give the correct results if called with the tid passed into mdlOutputs.
C, C++
The following example illustrates a correct usage of this macro:
static void mdlOutputs( SimStruct *S, int_T tid )
{
double t;
if(ssIsSampleHit(S,0,tid)) {
t = ssGetTaskTime(S,0);
ssPrintf("Task 0 sample hit in %s time = %g\n",
ssGetPath(S),t);
}
if(ssIsSampleHit(S,1,tid)) {
t = ssGetTaskTime(S,1);
ssPrintf("Task 1 sample hit in %s time = %g\n",
ssGetPath(S),t);
}
}

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