-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPresentLearning.m
560 lines (513 loc) · 27.7 KB
/
PresentLearning.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
function restruct = PresentLearning(fid,fid2,social,observer_mode,just_record)
% fid - first file name where data is stored for non-social leraning/ read
% from for social learning.
% fid2 - second file name where data will be stored for stages 4 and above
% social - true/false to indicate if social learning
% observer_mode - true/false to indicate if just observing as experimenter.Defaults to false
% Set default observer_mode to false if unavailable
if nargin<4
observer_mode = false;
end
if nargin<5 || observer_mode==false
just_record = false;
end
restruct = [];
% Assume files named as pnL.mat for person n
split_fid = strsplit(fid2,filesep);
split_fid = strsplit(split_fid{end},'.');
pid = split_fid{1};
pid = pid(1:end-1);
% Clear the workspace and the screen
sca;
close all;
% Here we call some default settings for setting up Psychtoolbox
PsychDefaultSetup(2);
% Seed the random number generator.
if(social ~= true && observer_mode ~= true)
rng('shuffle');
out_rngstate = rng;
else
loaded_values = load(fid);
if observer_mode == true
loaded_values2 = load(fid2);
end
rng(loaded_values.out_rngstate);
end
if social == true
socialOG = 1;
else
socialOG = 0;
end
if just_record ~= true
% Get the screen numbers. This gives us a number for each of the screens
% attached to our computer. For help see: Screen Screens?
screens = Screen('Screens');
% Draw we select the maximum of these numbers. So in a situation where we
% have two screens attached to our monitor we will draw to the external
% screen. When only one screen is attached to the monitor we will draw to
% this. For help see: help max
screenNumber = max(screens);
% Define black and white (white will be 1 and black 0). This is because
% luminace values are (in general) defined between 0 and 1.
% For help see: help WhiteIndex and help BlackIndex
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
% Open an on screen window and color it white.
% For help see: Screen OpenWindow?
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, white);
% Get the size of the on screen window in pixels.
% For help see: Screen WindowSize?
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
% Get the centre coordinate of the window in pixels
% For help see: help RectCenter
[xCenter, yCenter] = RectCenter(windowRect);
% Instruction rect is 70% at center
Instr_dst_rect = CenterRectOnPointd([0,0,0.7*screenXpixels,0.7*screenYpixels],xCenter,yCenter);
% Enable alpha blending for anti-aliasing
% For help see: Screen BlendFunction?
% Also see: Chapter 6 of the OpenGL programming guide
Screen('BlendFunction', window, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else %just placeholders for stuff that might be neededfor syntax. No use though
window = 0;
windowRect = [0,0,0,0];
end
%Load Images
image_dir = ['Images' filesep];
%Define cells to suggest mapping from face to fish
faces = cell(2);
fish = cell(2);
%Permute to generate a mapping and load the images
facepermutations = randperm(4);
fishpermutations = randperm(4);
%For faces along column is associated faces
faces{1,1} = imread([image_dir 'Face' num2str(facepermutations(1)) '.png']);
faces{1,2} = imread([image_dir 'Face' num2str(facepermutations(2)) '.png']);
faces{2,1} = imread([image_dir 'Face' num2str(facepermutations(3)) '.png']);
faces{2,2} = imread([image_dir 'Face' num2str(facepermutations(4)) '.png']);
%For fishes first row are the initial 2 fishes and next row are the fishes
%that come next
fish{1,1} = imread([image_dir 'Fish' num2str(fishpermutations(1)) '.png']);
fish{1,2} = imread([image_dir 'Fish' num2str(fishpermutations(2)) '.png']);
fish{2,1} = imread([image_dir 'Fish' num2str(fishpermutations(3)) '.png']);
fish{2,2} = imread([image_dir 'Fish' num2str(fishpermutations(4)) '.png']);
%Setup parameters for experiment
numblocks = [8 8 8 1 1]; %TODO: For stage 4, 1 block/16 blocks?
continuous_correct_expected = [8 8 12 16 16]; %TODO: Not clear for stage 4, clarify.
numtrials = [4 8 12 16 16];
numfaces = [2 4 4 4 4];
numfishes = [2 2 4 4 4];
%Create face,fish indice for easy cell access, each row in the indices
%correspond to a face/fish
[p,q] = meshgrid(1:size(faces,1),1:size(faces,2));
faceindices = [p(:) q(:)];
[p,q] = meshgrid(1:size(fish,1),1:size(fish,2));
fishindices = [p(:) q(:)];
%Input recording/display variables
if (social ~= true && observer_mode ~= true)
first_recorder = outholder;
curr_recorder = first_recorder;
else
curr_recorder = loaded_values.first_recorder;
move_index = 1;
end
if observer_mode == true
second_recorder = loaded_values2.second_recorder;
else
second_recorder = outholder;
end
%Display/hide feedback
feedback = true;
%my (Dave's) attempt at instruction screens for beginning
if just_record ~= true
if social ~= true
instr_text = ['Welcome! \n\nIn this study, you will be playing a simple game where your job is to learn new',...
' information about different people. You will see drawings of people who each have some pet',...
' fish. Different people have different kinds of fish. Your job is to learn which kinds of fish each',...
' person has. This study has two parts. Part 1 will be a learning phase, while Part 2 will be a test phase.',...
'\n\nIn the first section, you will learn which kinds of fish each person has by making guesses and ',...
'receiving feedback on your guesses. After you complete this initial learning section, you will ',...
'proceed onto the testing phase of the experiment. In this part of the experiment, you will not ',...
'receive feedback. Your goal is to use what you learned during the first section to perform as well ',...
'as you can during this testing phase.',...
'\n\n\n Press any button to continue.'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_text,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
WaitSecs(.5);
KbStrokeWait;
instr_texttwo = ['Part 1',...
'\n\n\n On each trial of this section, you will see a drawing of a person along with two fish. For each ',...
'trial, your task is to indicate which fish you think the person has. At first, you will have to guess. ',...
'You will indicate your responses using the LEFT and RIGHT arrow keys on the keyboard.',...
'\n\nAfter you make your decision by pressing the corresponding key, your selection will be circled ',...
'on the screen and you will receive a message that will say whether your selection was correct or incorrect. ',...
'\n\n Your goal is to learn which kinds of fish each person has. You will be tested on what you learn in part 2 of this study.',...
'\n\n\n Press the space bar to continue.'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_texttwo,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
WaitSecs(.5);
KbStrokeWait;
else
instr_text = ['Welcome \n\n In this study, you will be playing a simple game where your job is to learn new ',...
'information about different people. You will see drawings of people who each have some pet ',...
'fish. Different people have different kinds of fish. Your job is to learn which kinds of fish each ',...
'person has. This study has two parts. Part 1 will be a learning phase, while Part 2 will be a test phase. ',...
'\n\nYou have been assigned to the social learning condition. This means that in the first section, you ',...
'will learn which kinds of fish each person has by observing the screen of a previous participant ',...
'from when they completed the learning phase. You will see them make decisions and see the ',...
'feedback they received on each decision. After you complete this initial learning section, you ',...
'will proceed onto the testing phase of the experiment. In this part of the experiment, you will ',...
'make decisions yourself and will not receive feedback. Your goal is to use what you learned ',...
'from observing the other participant during the first section to perform as well as you can during this testing phase.',...
'\n\n\n Press any button to continue.'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_text,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
WaitSecs(.5);
KbStrokeWait;
instr_texttwo = ['Part 1',...
'\n\n\n In this section, you will just watch the other participant�s screen and observe how they responded ',...
'to a series of trials. On each trial, you will see the other participant being presented with a ',...
'drawing of a person along with two fish. Their task was to indicate which fish they thought the ',...
'person on the screen has. ',...
'\n\nWhen they make a selection, a circle will appear on the screen indicating which fish they chose ',...
'and you will see a message they received that says whether their selection was correct or incorrect. ',...
'\n\nYour goal is to learn which kinds of fish each person has by watching this participant. You ',...
'will be tested on what you learn in part 2 of this study.',...
'\n\n\n Press the space bar to continue.'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_texttwo,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
WaitSecs(.5);
KbStrokeWait;
end
end
trial_num = 1;
% Stage 1 to 7 which in code terms is upto 5 as actual 5,6 handled in a
% different function
for stage=1:5
%Generate all possible combinations then permute for the order.
% first 2 colums contain face indices, next two contain left fish, next
% two the right fish, next column contains the correct fish detail.
% Last column tells the fish trial type 1-original fish face, 2-new
% face original fish, 3-original face new fish, 4- New face, new fish
Trial_typefish = [1;1;2;2]; % Just set it manually for now and slice
all_combo = [faceindices(1:numfaces(stage),:) , repmat(fishindices(1:2,:),numfaces(stage)/2,1), repmat(flipud(fishindices(1:2,:)),numfaces(stage)/2,1), ones(numfaces(stage),1), Trial_typefish(1:numfaces(stage));
faceindices(1:numfaces(stage),:) , repmat(flipud(fishindices(1:2,:)),numfaces(stage)/2,1), repmat(fishindices(1:2,:),numfaces(stage)/2,1), 2*ones(numfaces(stage),1), Trial_typefish(1:numfaces(stage))
];
if stage >= 3
all_combo = [all_combo;
faceindices(1:2,:) , fishindices(3:4,:), flipud(fishindices(3:4,:)), ones(2,1), 3*ones(2,1);
faceindices(1:2,:) , flipud(fishindices(3:4,:)), fishindices(3:4,:), 2*ones(2,1), 3*ones(2,1)
];
end
if stage>=4
all_combo=[all_combo;
faceindices(3:4,:) , fishindices(3:4,:), flipud(fishindices(3:4,:)), ones(2,1), 4*ones(2,1);
faceindices(3:4,:) , flipud(fishindices(3:4,:)), fishindices(3:4,:), 2*ones(2,1), 4*ones(2,1)
];
% Set social false from now as we want them to also learn normally
social = false;
%Reset trial counter
trial_num = 1;
%if social == true
%social = false;
%oldsocial = true;
%display(social)
%display(oldsocial)
%else oldsocial = social
%end
% No feedback from now on
feedback = false;
% Start recording separately from stage 4 as no feedback so only
% for analytical reasons. This'll be recorded even for social so
% separate.
curr_recorder = second_recorder;
%If in observer mode we want to reset move_index at this point as
%we start reading a new file
if observer_mode == true
move_index = 1;
end
if just_record ~= true
%For 4th stage display some instructions
if stage == 4
if socialOG ~= 1
instr_text = ['Part 2\n\n\n',...
'Good! Now you will move onto the test part of the experiment. In this part of the experiment you ',...
'will need to remember what you have learned so far. You will NOT be shown the correct ',...
'answers. At the end of the experiment, the computer will tell you how many you got right. Good Luck!',...
'\n\n Press any button to continue'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_text,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
KbStrokeWait;
else
instr_text = ['Part 2\n\n\n',...
'Good! Now you will move onto the test part of the experiment. In this part of the experiment, ',...
'you will need to remember what you have learned so far. You will respond yourself and will ',...
'NOT be shown the correct answers. At the end of the experiment, the computer will tell you how ',...
'many you got right. Good Luck!',...
'\n\n Press any button to continue'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_text,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
KbStrokeWait;
end
end
%For 7th stage (5th stage in the terms used in code) display some instructions
if stage == 5
instr_text = ['Good! You have completed the memory test.\n\n',...
'In this final part of the experiment you will be tested the last time on what you have learned. ',...
'Again, you will NOT be shown the correct answers. Good Luck!',...
'\n\n Press any button to continue'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_text,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
KbStrokeWait;
end
end
end
displayperm = randperm(size(all_combo,1));
%Variable to track continuous correct answers for premature exit
continuous_correct = 0;
%Begin process to each trial
for blocks=1:numblocks(stage)
for trial=1:numtrials(stage)
%create struct for the trial
trial_struct = struct('ID',pid,'Cond',socialOG,'Stage',stage,'Learning_Trial','','Test_Trial','','Test_Trial_Final','',...
'Trial_typefish',all_combo(displayperm(trial),8),'WordL_Trial','','WordT_Trial','','Trial_typeword','',...
'Face',(all_combo(displayperm(trial),1)-1)*2+all_combo(displayperm(trial),2),...
'Fish_left',(all_combo(displayperm(trial),3)-1)*2+all_combo(displayperm(trial),4),...
'Fish_right',(all_combo(displayperm(trial),5)-1)*2+all_combo(displayperm(trial),6),...
'Word','','Resp','','Ans',-2*mod(all_combo(displayperm(trial),7),2)+1,'Corr','','RT','');
%Debug print
disp(['In trial ' num2str(trial) ' block ' num2str(blocks) ' stage' num2str(stage) ' move_index ' num2str(move_index) ' continuous correct ' num2str(continuous_correct)]);
%If continuous correct threshold reached lets just add empty
%record to results and continue
if continuous_correct >= continuous_correct_expected(stage)
%Implicitly assuming that only upto stage 3 we can have
%premature termination
trial_struct.Learning_Trial = trial_num;
restruct = [restruct;trial_struct];
trial_num = trial_num + 1;
continue
end
%Calculate image sizes and scaling.
if just_record ~= true
[As1,As2,As3] = size(faces{all_combo(displayperm(trial),1),all_combo(displayperm(trial),2)});
A_asp_ratio = As2/As1;
A_newh = screenYpixels/6;
A_neww = A_asp_ratio*A_newh;
A_theRect = [0 0 A_neww A_newh];
%Position it in X center and 1/4th way from top.
A_dst_rect = CenterRectOnPointd(A_theRect,screenXpixels/2,screenYpixels/6);
[Xs1,Xs2,Xs3] = size(fish{all_combo(displayperm(trial),3),all_combo(displayperm(trial),4)});
X_asp_ratio = Xs2/Xs1;
X_newh = screenYpixels/8;
X_neww = X_asp_ratio*X_newh;
X_theRect = [0 0 X_neww X_newh];
%Position it in X center and 4/6th way from top.
X1_dst_rect = CenterRectOnPointd(X_theRect,screenXpixels/4,0.5*screenYpixels);
X2_dst_rect = CenterRectOnPointd(X_theRect,3*screenXpixels/4,0.5*screenYpixels);
%Draw the face
imageTexture = Screen('MakeTexture',window,faces{all_combo(displayperm(trial),1),all_combo(displayperm(trial),2)});
Screen('DrawTexture', window, imageTexture, [], A_dst_rect, 0);
%Draw the fishes
imageTexture = Screen('MakeTexture',window,fish{all_combo(displayperm(trial),3),all_combo(displayperm(trial),4)});
Screen('DrawTexture', window, imageTexture, [], X1_dst_rect, 0);
imageTexture = Screen('MakeTexture',window,fish{all_combo(displayperm(trial),5),all_combo(displayperm(trial),6)});
Screen('DrawTexture', window, imageTexture, [], X2_dst_rect, 0);
% Draw text in the bottom of the screen in black
Screen('TextSize', window, 40);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, 'Which fish does this person have?', 'center',...
screenYpixels * 0.65, [0 0 0]);
DrawFormattedText(window, 'Use Left or Right key to choose.', 'center',...
screenYpixels * 0.75, [0 0 0]);
% Flip to the screen. This command basically draws all of our previous
% commands onto the screen. See later demos in the animation section on more
% timing details. And how to demos in this section on how to draw multiple
% rects at once.
% For help see: Screen Flip?
Screen('Flip', window,0,1);
end
%Start timing input if in non-social mode
% Now we have drawn to the screen we wait for a keyboard button press (any
% key) to terminate the demo. For help see: help KbStrokeWait
%For now putting while loop but needs to be done as multiple
%inputs.. Or maybe not to avoid unwanted inputs
if(social~=true && observer_mode~= true) %Take input and give feedback
initsec = GetSecs;
while(true)
[secs,keycode,deltasec] = KbStrokeWait;
rightarrow = KbName('RightArrow');
leftarrow = KbName('LeftArrow');
escape = KbName('ESCAPE');
if keycode(rightarrow) || keycode(leftarrow)
%Capture time
endsec = GetSecs;
curr_recorder.input_timing = [curr_recorder.input_timing (endsec-initsec)];
%Detect if correct answer
if (keycode(leftarrow) && all_combo(displayperm(trial),7) == 1) || (keycode(rightarrow) && all_combo(displayperm(trial),7) == 2)
if feedback==true
display_color = [0 1 0];
DrawFormattedText(window, 'Correct', 'center',...
screenYpixels * 0.85, display_color);
end
continuous_correct = continuous_correct+1;
else
if feedback==true
display_color = [1 0 0];
DrawFormattedText(window, 'Incorrect', 'center',...
screenYpixels * 0.85, display_color);
end
continuous_correct = 0;
end
curr_recorder.correct_ans = [curr_recorder.correct_ans all_combo(displayperm(trial),7)];
% If in any phase we don't want feedback, we will
% still circle their choice but show it in grey
if feedback == false
display_color = [0.6,0.6,0.6];
end
%Draw circles and record moves - 1 = left, 2 = right
if keycode(leftarrow)
curr_recorder.moves = [curr_recorder.moves 1];
Screen('FrameOval',window,display_color,GrowRect(X1_dst_rect,15,15),3,3);
else
curr_recorder.moves = [curr_recorder.moves 2];
Screen('FrameOval',window,display_color,GrowRect(X2_dst_rect,15,15),3,3);
end
Screen('Flip', window);
WaitSecs(1);
break
% elseif keycode(escape)
% disp('Exit by escape')
% sca;
% return
end
end
elseif just_record ~= true %Replay stuff
%Detect if correct answer
if curr_recorder.correct_ans(move_index) == curr_recorder.moves(move_index)
display_color = [0 1 0];
DrawFormattedText(window, 'Correct', 'center',...
screenYpixels * 0.85, display_color);
continuous_correct = continuous_correct+1;
else
display_color = [1 0 0];
DrawFormattedText(window, 'Incorrect', 'center',...
screenYpixels * 0.85, display_color);
continuous_correct = 0;
end
%Draw appropriate circle
if curr_recorder.moves(move_index)==1
Screen('FrameOval',window,display_color,GrowRect(X1_dst_rect,15,15),3,3);
else
Screen('FrameOval',window,display_color,GrowRect(X2_dst_rect,15,15),3,3);
end
%Wait as long as input user did before display.
WaitSecs(curr_recorder.input_timing(move_index));
move_index = move_index+1;
Screen('Flip', window);
%Wait 1 sec before clearing like in non-social input
WaitSecs(1);
else %Just record case
% Based on stage input trial num in correct field
if stage <= 3
trial_struct.Learning_Trial = trial_num;
elseif stage == 4
trial_struct.Test_Trial = trial_num;
elseif stage == 5
trial_struct.Test_Trial_Final = trial_num;
trial_struct.Stage = 7; %because of the way we have written
end
trial_struct.Resp = -2*mod(curr_recorder.moves(move_index),2)+1;
trial_struct.RT = curr_recorder.input_timing(move_index);
if curr_recorder.correct_ans(move_index) == curr_recorder.moves(move_index)
trial_struct.Corr = 1;
continuous_correct = continuous_correct+1;
else
trial_struct.Corr = 0;
continuous_correct = 0;
end
move_index = move_index + 1;
end
restruct = [restruct;trial_struct];
if just_record ~= true
%Clear screen and display blank for 1 sec
Screen('Flip', window);
WaitSecs(1);
end
trial_num = trial_num + 1;
%Premature exit if correct for required number of times
% if continuous_correct >= continuous_correct_expected(stage)
% break
% end
end
% if continuous_correct >= continuous_correct_expected(stage)
% break
% end
end
%put in result text for stage 4
if stage == 4
if just_record ~= true
% (1:16) added in the next command to help it identify the counts
% correctly in observer mode.. Hackish needs to be refined.
instr_text = ['You got ',num2str(sum(curr_recorder.moves(1:16) == curr_recorder.correct_ans(1:16))),...
'/',num2str(size(curr_recorder.moves(1:16),2)), ' correct'];
Screen('TextSize', window, 35);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, instr_text,'center', 'center', black);
Screen('Flip', window);
WaitSecs(1);
end
%Call function for actual stage 5 (words round)
%rng states maybe redundant but better be safe
cur_rngstate = rng;
if observer_mode == true
extra_params = struct('pid',pid,'socialOG',socialOG);
[word_recorder,cur_rngstate,word_restruct] = PresentWords(cur_rngstate,window,windowRect,faces,observer_mode,loaded_values2.word_recorder,just_record,extra_params);
else
[word_recorder,cur_rngstate,word_restruct] = PresentWords(cur_rngstate,window,windowRect,faces);
end
restruct = [restruct;word_restruct];
rng(cur_rngstate);
end
end
% end text
if just_record ~= true
end_text = ['You have completed the learning portion of the study. ',...
'Next we have some simple debriefing questions for you to answer.',...
'\n\nPlease let the experimenter know that you are done with this first section ',...
'so that they can get you started on the final few questions.'];
Screen('TextSize', window, 24);
Screen('TextFont', window, 'Times');
DrawFormattedText(window, end_text,'wrapat', 'center', black, 70, [], [], 1.5, [], Instr_dst_rect);
Screen('Flip', window);
WaitSecs(.5);
KbStrokeWait;
sca;
end
% Clear the screen. "sca" is short hand for "Screen CloseAll". This clears
% all features related to PTB. Note: we leave the variables in the
% workspace so you can have a look at them if you want.
% For help see: help sca
% If social learning mode then don't save the first part as it is just a
% replay
% If observer mode then don't save anything, it is purely observation
if observer_mode ~= true
if socialOG == 0
save(fid,'out_rngstate','first_recorder');
end
% Save second part for everyone
save(fid2,'second_recorder','word_recorder');
end
end