Fig6B.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. % clasification of units per quadrand in d.d. plot
  2. load('all_dd.mat');
  3. aw_nav=y3(~isnan(y3(:,1)),1);
  4. aw_com=y3(~isnan(y3(:,2)),2);
  5. an_nav=y3(~isnan(y3(:,3)),3);
  6. an_com=y3(~isnan(y3(:,4)),4);
  7. n_aw=numel(aw_nav);
  8. n_an=numel(an_nav);
  9. class_an=nan(n_an,1);
  10. for u=1:n_an
  11. if an_nav(u)>0 && an_com(u)>0 % first quadrant
  12. class_an(u,1)=1;
  13. elseif an_nav(u)>0 && an_com(u)<=0 % second quadrant
  14. class_an(u,1)=2;
  15. elseif an_nav(u)<=0 && an_com(u)>0 % forth quadrant
  16. class_an(u,1)=4;
  17. elseif an_nav(u)<=0 && an_com(u)<=0 % third quadrant
  18. class_an(u,1)=3;
  19. end
  20. end
  21. class_aw=nan(n_aw,1);
  22. for u=1:n_aw
  23. if aw_nav(u)>0 && aw_com(u)>0 % first quadrant
  24. class_aw(u,1)=1;
  25. elseif aw_nav(u)>0 && aw_com(u)<=0 % second quadrant
  26. class_aw(u,1)=2;
  27. elseif aw_nav(u)<=0 && aw_com(u)>0 % forth quadrant
  28. class_aw(u,1)=4;
  29. elseif aw_nav(u)<=0 && aw_com(u)<=0 % third quadrant
  30. class_aw(u,1)=3;
  31. end
  32. end
  33. prop_aw=histcounts(class_aw)*100/n_aw;
  34. prop_an=histcounts(class_an)*100/n_an;
  35. y=[prop_aw; prop_an];
  36. y=y';
  37. %% plotting
  38. red =[0.8500,0.3250, 0.0980];
  39. blue=[0,0.4470,0.7410];
  40. figure(1); set(gcf,'Position',[200 200 100 100])
  41. b=bar(prop_aw);
  42. b.EdgeColor=blue;
  43. b.FaceColor=blue;
  44. b.LineWidth =1.0;
  45. b.FaceAlpha = 0.2;
  46. b.BarWidth=0.75;
  47. xlim([0.25 4.75])
  48. ylabel('% units')
  49. xticklabels({'I','II','III','IV'});
  50. set(gca, 'box', 'off')
  51. set(gca, 'Color','none')
  52. set(gca,'linewidth',1);set(gca,'fontsize',8);
  53. figure(2); set(gcf,'Position',[400 200 100 100])
  54. b=bar(prop_an);
  55. b.EdgeColor=red;
  56. b.FaceColor=red;
  57. b.LineWidth =1.0;
  58. b.FaceAlpha = 0.2;
  59. b.BarWidth=0.75;
  60. xlim([0.25 4.75])
  61. ylabel('% units')
  62. xticklabels({'I','II','III','IV'});
  63. set(gca, 'box', 'off')
  64. set(gca, 'Color','none')
  65. set(gca,'linewidth',1);set(gca,'fontsize',8);
  66. %% save units # and their respective quadrant classification
  67. % looking for the units #
  68. load('all_data.mat')
  69. eq_=all_di(:,2)==0;
  70. aw_=all_di(:,3)==0;
  71. an_=all_di(:,3)==1;
  72. cell_aw=all_di(logical(eq_.*aw_),1);
  73. cell_an=all_di(logical(eq_.*an_),1);
  74. cell_aw=[cell_aw, class_aw];
  75. load('pt_data.mat')
  76. eq_=all_di(:,2)==0;
  77. an_=all_di(:,3)==1;
  78. cell_pt=all_di(logical(eq_.*an_),1);
  79. cell_an=[cell_an; cell_pt];
  80. cell_an=[cell_an, class_an];
  81. mode_aw=mode(class_aw);
  82. mode_an=mode(class_an);
  83. cell_mode_aw=cell_aw(cell_aw(:,2)==mode_aw,1); % spikes_cluster3/
  84. cell_mode_an=cell_an(cell_an(:,2)==mode_an,1); % spikes_cluster5/ and 6/ and 8/
  85. save('cell_an.mat', 'cell_an')
  86. save('cell_aw.mat', 'cell_aw')