Example: Using Nested Functions for Timers

Example code from MATLAB News & Notes article on nested functions.


Updated 1 Sep 2016

View License

This is a simple example of how nested functions can simplify the writing of callback functions for writing continuously-running applications. Callback functions are used by timer objects and the various objects in the Test & Measurement Toolboxes (Data Acquisition Toolbox, Instrument Control Toolbox, Image Acquisition Toolbox) to associate MATLAB code with events such as timers.
This example contains the code included in the October, 2005 MATLAB News & Notes tip on this topic.

Cite As

Michelle Hirsch (2023). Example: Using Nested Functions for Timers (https://www.mathworks.com/matlabcentral/fileexchange/8452-example-using-nested-functions-for-timers), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Counter and Timer Input and Output in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Updated license

Made available for download as an easy-to-install Toolbox file.

Added comments.

Updated copyright.