Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

ExtractAngleInfo.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. function [angle] = ExtractAngleInfo(StartPoke,EndPoke,animal)
  2. %[angle] = ExtractAngleInfo(StartPoke,EndPoke,animal)
  3. % Extract angle info from a given start and end poke port, and a given
  4. % specis of animal(Mice or Rat)
  5. %
  6. % Examples:
  7. % ExtractAngleInfo('MidC','TopR','Mice')
  8. % ExtractAngleInfo('MidC','TopR','Rat')
  9. %
  10. Pokes = {'MidR','TopR','BotR','MidC','TopL','MidL','BotL','BotC','null'};
  11. if sum(strcmp(EndPoke,Pokes))==0
  12. Pokes = {'D','B','F','G','A','C','E','H'};
  13. end
  14. if strcmp(animal,'Rat')
  15. cord = [129,58;101,83;101,33;73,58;...
  16. 45,83;17,58;45,33;73,18;nan,nan];
  17. elseif strcmp(animal,'Mice')
  18. cord = [129,40;100,55;100,25;71,40;...
  19. 52,55;13,40;42,25;71,17;nan,nan];
  20. end
  21. StartPoke_cord = cord(strcmp(StartPoke,Pokes),:);
  22. EndPoke_cord = cord(strcmp(EndPoke,Pokes),:);
  23. goes = EndPoke_cord-StartPoke_cord; %[dx,dy]
  24. if goes(1)==0 && goes(2)>0
  25. angle = pi/2;
  26. elseif goes(1)==0 && goes(2)<0
  27. angle = -pi/2;
  28. elseif goes(2)==0 && goes(1)<0
  29. angle = -pi;
  30. elseif goes(1)<0
  31. angle = pi+atan(goes(2)/goes(1));
  32. else
  33. angle = atan(goes(2)/goes(1));
  34. end
  35. angle(angle<0) = angle + 2*pi;
  36. %angle = angle*180/pi;
  37. end