-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetTargetsSaccMem.m
More file actions
39 lines (33 loc) · 1.33 KB
/
getTargetsSaccMem.m
File metadata and controls
39 lines (33 loc) · 1.33 KB
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
function [targetAngles, targetRadii, targetX, targetY, targetAnglesNewLoc, targetRadiiNewLoc, targetNewLocX, targetNewLocY] = getTargets(filename,stack_opts)
% Get target angles, radii, and x/y coordinates for each trial
%
% Inputs:
% filename - file name from which to extract targets
% stack_opts - stack options
%
% Outputs:
% targetAngles - target angle
% targetRadii - target radii
% targetX - target x-coordinate
% targetY - target y-coordinate
splitfile=regexp(filename,'/','split');
system(['rm -f Targets_*']);
grabtargs=['grab ' stack_opts ' -aD -o8 -i400:500 ' filename]
[status,result]=system(grabtargs);
system(['mv -f Targets_* Targets_' splitfile{6}(2:end)]);
file_targets=['Targets_' splitfile{6}(2:end)];
target=importdata(file_targets,' ',1);
system(['rm -f Targets_*']);
fixationX=target.data(:,6)/10;
fixationY=target.data(:,7)/10;
targetX=((target.data(:,12)/10)-fixationX);
targetY=((target.data(:,13)/10)-fixationY);
targetNewLocX=((target.data(:,18)/10)-fixationX);
targetNewLocY=((target.data(:,19)/10)-fixationY);
for i = 1:length(targetX)
targetRadii(i)=sqrt((targetX(i)^2)+(targetY(i)^2));
targetAngles(i)=atan2(targetY(i),targetX(i))*(180/pi);
targetRadiiNewLoc(i)=sqrt((targetNewLocX(i)^2)+(targetNewLocY(i)^2));
targetAnglesNewLoc(i)=atan2(targetNewLocY(i),targetNewLocX(i))*(180/pi);
end
end