I want to write a script for a memory experiment. Therefore, I am showing 4 numbers and I want my participants to remember the numbers and enter them into a screen later. Additionally, the numbers entered should be shown on the screen. How do I record the numbers? I tried " number(nTrials) = GetNumber(window1); " but it does not work and I cannot figure out the mistake or if that is even the right function. Does anybody know the answer? Thank you so much!
Here is the Code:
Screen(‘Preference’, ‘SkipSyncTests’, 2);
[w1,rect]=Screen(‘OpenWindow’, 0,0, [0 0 800 600]);
[center(1), center(2)]= RectCenter(rect);
nTrials = 8;
trailcount = ;
target_length = 4;
target_presented = randperm(9,target_length); % create target
target_solution = zeros(1, target_length);
target_answer = zeros(1,target_length);
% instruction
Screen(‘DrawText’, w1, ‘Please try to remember the following numbers’, center(1)-230, center(2)-10, 255);
Screen(‘Flip’, w1);
WaitSecs(3);
Screen(‘Flip’,w1);
% create Target
Screen(‘DrawText’, w1, num2str(target_presented), center(1)-100, center(2)-10, 255);
Screen(‘Flip’, w1);
WaitSecs(2);
%determine solution
target_solution = sort(target_presented);
% answer subject (=PROBLEM)
target_answer = GetEchoNumber(w1, ‘Please enter your answer’, center(1)-200,center(2)-10, 255);