calculate the time between 2 click
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Jan
2016-4-16
编辑:Jan
2016-4-16
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!