Is my loop counter correct?
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!