etoc

Read elapsed time from executables

Syntax

timeElapsed = etoc

Description

timeElapsed = etoc     return time since start of executable or mex file. In an executable, this function returns the time since the executable has started. In a mex file, this function returns the time since the MATLAB session has started.

Code Generation

This function is supported for code generation. It is designed for desktop deployment of a mex (.mex[]) or executable (.exe) file. It can not be placed in a MATLAB Function block. For use in Simulink, use the Soft Real-Time block.

Example

Running a MATLAB Executable File (mex) in Soft Real-Time

First, run the function ScheduleEticMatlabExample which prints to the MATLAB Command Window every 0.5 seconds. This function uses etic and etoc to schedule the printing.

Then, run the script buildMatlabSoftRealTimeExample which generates a mex file from ScheduleEticMatlabExample. Since etic and etoc are supported for code generation, the generated mex file ScheduleMatlabExample_mex prints to the MATLAB Command Window every 0.5 seconds.

See Also

Soft Real-Time