I am collecting a continuous recording from a sensor, but I will only need certain segments of the recording. I want to use a stopwatch in MATLAB to record the start and stop times of the relevant segments of data from the sensor. I need a function that starts a timer when I push one key, then stores the timer value when I press another key and that stops the timer when I press a third key. I was going to use the tic and toc functions . . . how do I get MATLAB to store the time elapsed since the last tic when I hit a certain key on the keyboard? Thanks!