|
1 | | -%% Experiment Parametes |
2 | | -%% Experimental Design |
3 | | -% function "experimental_design" while assign the blocks, conditions, and |
4 | | -% the number of targets that will be used in the motion localizer |
5 | | -%[names,targets,condition] = experimental_design(nrBlocks,range_targets); |
6 | | -[names,targets,condition,directions,isTarget] = experimental_design(nrBlocks,numEventsPerBlock,range_targets) ; |
7 | | - |
8 | | -numBlocks = length(names); % Create a variable with the number of blocks in the whole experiment |
9 | | - |
10 | | - |
11 | | -%% FUNCTION |
12 | | -if strcmp(device,'PC') |
13 | | - DrawFormattedText(w,'Waiting For Trigger',... |
14 | | - 'center', 'center', black); |
15 | | - Screen('Flip', w); |
16 | | - |
17 | | - % press key |
18 | | - KbWait(); |
19 | | - KeyIsDown=1; |
20 | | - while KeyIsDown>0 |
21 | | - [KeyIsDown, ~, ~]=KbCheck; |
22 | | - end |
23 | | - |
24 | | -% open Serial Port "SerPor" - COM1 (BAUD RATE: 11520) |
25 | | -elseif strcmp(device,'Scanner') |
26 | | - DrawFormattedText(w,'Waiting For Trigger','center', 'center', black); |
27 | | - Screen('Flip', w); |
28 | | - SerPor = MT_portAndTrigger; |
29 | | - Screen('Flip', w); |
30 | | -end |
31 | | - |
32 | | -%% Experiment Start (Main Loop) |
33 | | -experimentStartTime = GetSecs; |
34 | | - |
35 | | -%% To correct for the y-axis problem inside the scanner |
36 | | -if strcmp(device,'Scanner') |
37 | | - adjusted_yAxis = 2/3*th; % where the lower 1/3 of the screen is not appearing because of coil |
38 | | -elseif strcmp(device,'PC') |
39 | | - adjusted_yAxis = th; % y-axis is the same, no changes |
40 | | -end |
41 | | - |
42 | | -%% Pixels per degree |
43 | | -[mirrorPixelPerDegree] = mirror2Pixels (winRect,v_dist,mirror_width) ; % Calculate pixel per degree on the mirror surface |
44 | | - |
45 | | -%% fixation coordiates |
46 | | -fix_cord = [[tw/2 adjusted_yAxis/2]-fix_r*mirrorPixelPerDegree [tw/2 adjusted_yAxis/2]+fix_r*mirrorPixelPerDegree]; |
47 | | - |
48 | | -%% Experiment start |
49 | | -% The experment will wait (initial_wait) Secs before running the stimuli |
50 | | -Screen('FillOval', w, uint8(white), fix_cord); % draw fixation dot (flip erases it) |
51 | | -blank_onset=Screen('Flip', w); |
52 | | -WaitSecs('UntilTime', blank_onset + initial_wait); |
53 | | - |
54 | | -targetTime = []; |
55 | | -responseKey = []; |
56 | | -responseTime = []; |
57 | 1 |
|
58 | 2 | eventOnsets=zeros(numBlocks,numEventsPerBlock); |
59 | 3 | eventEnds=zeros(numBlocks,numEventsPerBlock); |
60 | 4 | eventDurations=zeros(numBlocks,numEventsPerBlock); |
61 | 5 |
|
62 | | -responsesPerBlock=zeros(numBlocks,1); |
| 6 | +responsesPerBlock=zeros(numBlocks,1);6 |
63 | 7 |
|
64 | 8 | playTime = zeros(numBlocks,1); |
65 | 9 |
|
|
0 commit comments