Determine The Input Time with tic,toc

조회 수: 1 (최근 30일)
Yusuf Oguzhan Turgut
Yusuf Oguzhan Turgut 2019년 6월 10일
댓글: Walter Roberson 2019년 6월 11일
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
Walter Roberson
Walter Roberson 2019년 6월 11일
Perhaps you should look at the third party Psychtoolbox

댓글을 달려면 로그인하십시오.

채택된 답변

per isakson
per isakson 2019년 6월 11일
편집: per isakson 2019년 6월 11일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by