필터 지우기
필터 지우기

Is my loop counter correct?

조회 수: 1 (최근 30일)
Adam Vilanova-Goldstein
Adam Vilanova-Goldstein 2020년 5월 29일
댓글: darova 2020년 5월 29일
I am trying to make a counter to see how many times this if statement is run. based on the way I wrote it, it should run once every 1 - 2 seconds for 4.5 -5.5 seconds (that is the length of the trial.
The loop counter that I wrote keeps spitting out numbers in the 100's.
loop = 0;
while time < BlockRec(trial,6) && keyIsDown && keyChange == false %this is the global loop
TriggerEvent = (1 / BlockRec(trial,3)) * BlockRec(trial,6); %check for timeout of trigger
if GetSecs() >= TriggerEvent %this if statement is what I am trying to count
StartSpeedTime = GetSecs();
TriggerEvent = StartSpeedTime + TriggerEvent;
loop = loop + 1;
BlockRec(trial,11) = loop; % BlockRec(trial,#) is how we record the data
end
.........
Basically I am trying to count how many times the event is triggered.
I can do the math on how many times it's SUPPOSED to happen but I want to double check and make sure that it's actually happening.
Also, I am using the PsychToolBox package.
  댓글 수: 1
darova
darova 2020년 5월 29일
It is correct

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by