calculate the time between 2 click

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

回答 (1 件)

Jan
Jan 2016 年 4 月 16 日
編集済み: Jan 2016 年 4 月 16 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

質問済み:

2016 年 4 月 16 日

編集済み:

Jan
2016 年 4 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by