calculate the time between 2 click

10 Ansichten (letzte 30 Tage)
Vid Foru
Vid Foru am 16 Apr. 2016
Bearbeitet: Jan am 16 Apr. 2016
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

Antworten (1)

Jan
Jan am 16 Apr. 2016
Bearbeitet: Jan am 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

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by