Hello,
I would like to know if this function is right. I have a dataset with 4 columns , the first and second column are the x,y coordinates for the participants locomotion, the third and fourth columns are the X,Y coordinates for the targets (total targets =9, ). I would like to know if the function will tell me whether the participant reached a target or several targets during de locomotion. The aim is to create a column with the result (x>=X && x<=X+w )&&( y>=Y && y<=Y+h). Thanks
w=0.2;%width
h= 0.2;% height
Reach_target=b'
data= [data Reach_target];
function b= proof(x,X,y,Y)
b=[];
for i= 1:length(x)
for ii= 1:length(X)
if x(i)>=X(ii) && x(i)<=X(ii)+w;
d= 1;
end
end
end
for e= 1:length(y)
for ee= 1:length(Y)
if y(e)>=Y(ee) && y(e)<=Y(ee)+h;
c=1;
end
end
end
b=d+c;
end
0 Comments
Sign in to comment.