-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQs.m
95 lines (70 loc) · 2.32 KB
/
Qs.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
%% Get questionnaire information
% Inge Huijsmans
% 2014-12-17
%
% This is a seperate script to attain demographic information and
% administer questionnares.
%
% Script opens a screen and calls qs_demographic function
%Change WD
SCANNER = {'Skyra','Dummy','Debugging','Keyboard','buttonbox'}; SCANNER = SCANNER{4};
% setup bitsi stuff for button responses
setup_bits;
%% Screen stuff
%Skips the 'Welcome to psychtoolbox message'
olddebuglevel=Screen('Preference', 'VisualDebuglevel', 1);
%At the beginning of each script matlab does synctests. Level 1 and 2
%prevent those tests. What does 0 do?
Screen('Preference', 'SkipSyncTests', 0);
% Get the screen numbers
screens = Screen('Screens');
% Draw to the external screen if avaliable
screenNumber = max(screens);
% Define black and white
white = 255;
black = 0;
yellow=[255 255 0];
green = [0 255 0];
red = [255 0 0];
% Open an on screen window
[window, windowRect] = Screen('OpenWindow',screenNumber,black);
HideCursor;
% Get the size of the on screen window
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
%Other applications compete with windows for resources. These lines make
%sure matlab wins.
prioritylevel=MaxPriority(window);
Priority(prioritylevel);
% Get the centre coordinate of the window
[xCenter, yCenter] = RectCenter(windowRect);
[wth, hth] = Screen('WindowSize', window);
%Textstuff
penWidthPixels = 4;
Screen('TextFont', window, 'Ariel');
Screen('TextSize', window, 32);
KbName('UnifyKeyNames');
%% Counterbalancing BS
%Set ppnr
ppnr_str = openended(window, 'Participant Nr:', white);
ppnr = str2double(ppnr_str);
%% Saving
%Results dir
results_dir = [cd '\Results\'];
%Prepare data logging
time = datestr(now, 'DD-HH-MM');
filename = [results_dir, sprintf('Demographics_ppnr_%i_time_%s_data.txt', ppnr, time)];
fid = fopen(filename,'a+t');
labels = {'q_nr','response','question', 'RT','Questionnaire','ppnr'};
%Make questionnaires
feedback = Qs_demographics(window, ppnr);
feedback = feedback.';
%Save data
fprintf(fid,'%s\t%s\t%s\t%s\t%s\t%s\n',labels{:});
fprintf(fid,'%i\t%s\t%s\t%i\t%s\t%i\n',feedback{:});
%% Finished instructions %%
instruct_dir = [cd '\Instructions\Qs\'];
nextkey = 'rightarrow';
backkey = 'leftarrow';
instructions(window, instruct_dir, 8, nextkey, backkey);
Screen('CloseAll')
return