Uses the high-resolution performance counter to get the time which exceeds one microsecond accuracy.
time = hat;
% do some calculations
diff = hat - time;
Cite As
Ivo Houtzager (2026). High Accuracy Timer (https://ch.mathworks.com/matlabcentral/fileexchange/16534-high-accuracy-timer), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2012b
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Clocks and Timers in Help Center and MATLAB Answers
Tags
Acknowledgements
Inspired: Simulink Block for Real Time Execution
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
