0
下面的代碼不會起作用,因爲該程序將不知道,如果試驗次數我們對是20整除基本上,我想檢查試用= 20,40 ,60等,如果是的話,如果他們願意的話可以休息一下。檢查如果一個數整除20 MATLAB
numTrials = 345;
for trial = 1:ntrials
% Take a break every 20 trials, subject can press space key to move on
if mod(trial, 20) == 0
breakText = ['Take a break or press the spacebar to continue'];
tic
while doc < 30 && ~keyPress
DrawFormattedText(window, breakText, 'center', 'center', black)
Screen('Flip', window);
if (keyCode(spaceKey) == 1)
break;
end
end
end
在此先感謝!
爲什麼它不工作?看起來像檢查一個數字是否可以被20整除。 – Suever
問題是我想做的事情是這樣的:如果試用= MOD(試用,20)== 0,但我不能使用等於運算這樣的。我需要檢查的是試驗我們對是20 – collegesista
整除你已經做以'MOD(試用,20)== 0' – Suever