0

私は実験コードを書いていますが、このコードで立ち往生しています。

アイデアは、2 つの画像とその下にテキストを表示することです。参加者は、これらのオプションから選択する必要があります。

キーボードに「z」、ジョイスティックに「m」を割り当てました。

私の質問は: 1. While ループの何が問題なのですか? 2.マウスまたはキーボードの矢印で強調表示できる画像の下に4つの選択ボックスを作成する方法を知っている人はいますか?

トライアル用 = 1:16 Screen ('FillRect', mainwin, bgcolor);

% Display keyboard and joystick images
Screen('DrawTexture', mainwin, keyboard, [], leftRect);
Screen('DrawTexture', mainwin, joystick, [], rightRect);
Screen('DrawText',mainwin,['Welcome to the Experiment!'] ,xCenter+150, yCenter+100,textcolor);
Screen('DrawText',mainwin,['Press z to select mental effort or m for physical effort.'] ,xCenter+350, yCenter+500,textcolor);
Screen('Flip', mainwin);
WaitSecs(3);

keyIsDown=0;
while 1
[keyIsDown, secs, keyCode] = KbCheck;
if keyIsDown;
    %checking which keyboard input has been pressed
    if keyCode(Key1);
        Screen('DrawTexture', mainwin, keyboard, [], leftRect);
    elseif keyCode(Key2);
        Screen('DrawTexture', mainwin, joystick, [], rightRect);
        break;
    else keyCode(escKey)
        ShowCursor;
        fclose(outfile);
        Screen('CloseAll');
        return;
    end
end 
end 
 trialorder = Shuffle(1:nTrialsPerGroup); % randomize trial order for each block

終わり

4

0 に答える 0