Fig6B.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\class_quad_aw.pdf',...
  54. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  55. figure(2); set(gcf,'Position',[400 200 100 100])
  56. b=bar(prop_an);
  57. b.EdgeColor=red;
  58. b.FaceColor=red;
  59. b.LineWidth =1.0;
  60. b.FaceAlpha = 0.2;
  61. b.BarWidth=0.75;
  62. xlim([0.25 4.75])
  63. ylabel('% units')
  64. xticklabels({'I','II','III','IV'});
  65. set(gca, 'box', 'off')
  66. set(gca, 'Color','none')
  67. set(gca,'linewidth',1);set(gca,'fontsize',8);
  68. exportgraphics(gcf,'E:\Users\User\Desktop\delay paper\anesthetized\figures_paper\class_quad_an.pdf',...
  69. 'Resolution',300','ContentType','vector','BackgroundColor','none')
  70. %% save units # and their respective quadrant classification
  71. % looking for the units #
  72. load('all_data.mat')
  73. eq_=all_di(:,2)==0;
  74. aw_=all_di(:,3)==0;
  75. an_=all_di(:,3)==1;
  76. cell_aw=all_di(logical(eq_.*aw_),1);
  77. cell_an=all_di(logical(eq_.*an_),1);
  78. cell_aw=[cell_aw, class_aw];
  79. load('pt_data.mat')
  80. eq_=all_di(:,2)==0;
  81. an_=all_di(:,3)==1;
  82. cell_pt=all_di(logical(eq_.*an_),1);
  83. cell_an=[cell_an; cell_pt];
  84. cell_an=[cell_an, class_an];
  85. mode_aw=mode(class_aw);
  86. mode_an=mode(class_an);
  87. cell_mode_aw=cell_aw(cell_aw(:,2)==mode_aw,1); % spikes_cluster3/
  88. cell_mode_an=cell_an(cell_an(:,2)==mode_an,1); % spikes_cluster5/ and 6/ and 8/
  89. save('cell_an.mat', 'cell_an')
  90. save('cell_aw.mat', 'cell_aw')