Collecting user response (numbers)

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? :frowning: 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);

% create Target
Screen(‘DrawText’, w1, num2str(target_presented), center(1)-100, center(2)-10, 255);
Screen(‘Flip’, w1);

%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);

Show a minimal complete example that we can actually run, and also post the error you get. Like this no one can help you

1 Like

Probably you need help GetEchoNumber instead of help GetNumber. Cfe. SuperShapeDemo.m for a user of this function.

1 Like

Sorry! thank for your help though! I updated my question:)
Is it helpful or is something missing?

Code looks as if it should work, although the use of WaitSecs for timed stimulus presentation is suboptimal, but unrelated to your problem. If it doesn’t, feel free to buy a paid support membership → help PsychPaidSupportAndServices. Our special offer end of year sale has just begun, so now only 99 Euros + tax instead of 150 + tax.