calculate the time between 2 click
4 views (last 30 days)
Show older comments
hi how can i measure the time between 2 click in Matlab?(ex: 1er click(or key) start the timer, the second click(key) stop the timer) thanks
0 Comments
Answers (1)
Jan
on 16 Apr 2016
Edited: Jan
on 16 Apr 2016
function TestGUI
FigH = figure('WindowButtonDownFcn', @myClick, ... % Mouse click
'WindowKeyPressFcn', @myClick); % Key press
handles.running = false;
handles.time = 0;
guidata(FigH, handles);
end
function myClick(hObject, EventData)
handles = guidata(hObject);
if handles.running % Display the time between clicks:
disp(etime(clock, handles.time));
handles.running = false;
else % Start the timer:
handles.running = true;
handles.time = clock;
end
guidata(hObject, handles);
end
0 Comments
See Also
Categories
Find more on Programming Utilities in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!