Determine The Input Time with tic,toc

1 visualización (últimos 30 días)
Yusuf Oguzhan Turgut
Yusuf Oguzhan Turgut el 10 de Jun. de 2019
Comentada: Walter Roberson el 11 de Jun. de 2019
Hello, I want to elapse the time that user spend on entering input. How can i do that ? I tried this below but MATLAB gave like 3.6175e-05 seconds. It looks really short. Here is my code
tic;
userinput = get(hObject,'String');
ts=toc;
disp(ts);
a = 5;
timeratio = ts/a ;
set(handles.text12,'String',num2str(timeratio,'%.0f'));
disp(timeratio);
  1 comentario
Walter Roberson
Walter Roberson el 11 de Jun. de 2019
Perhaps you should look at the third party Psychtoolbox

Iniciar sesión para comentar.

Respuesta aceptada

per isakson
per isakson el 11 de Jun. de 2019
Editada: per isakson el 11 de Jun. de 2019
I assume that hObject is a uicontrol object of style edit.
Your current script reads the elapse time of getting the current string-value of the edit box. That time is not affected by the users interaction with the edit box.
User interaction with the edit box object invokes various callbacks (if set up properly). I assume that it is possible to let one callback run tic and another toc. The callbacks are well documented, see Callbacks for Specific Components as a starting point.

Más respuestas (0)

Categorías

Más información sobre Timing and presenting 2D and 3D stimuli en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by