% clasification of units per quadrand in d.d. plot load('all_dd.mat'); aw_nav=y3(~isnan(y3(:,1)),1); aw_com=y3(~isnan(y3(:,2)),2); an_nav=y3(~isnan(y3(:,3)),3); an_com=y3(~isnan(y3(:,4)),4); n_aw=numel(aw_nav); n_an=numel(an_nav); class_an=nan(n_an,1); for u=1:n_an if an_nav(u)>0 && an_com(u)>0 % first quadrant class_an(u,1)=1; elseif an_nav(u)>0 && an_com(u)<=0 % second quadrant class_an(u,1)=2; elseif an_nav(u)<=0 && an_com(u)>0 % forth quadrant class_an(u,1)=4; elseif an_nav(u)<=0 && an_com(u)<=0 % third quadrant class_an(u,1)=3; end end class_aw=nan(n_aw,1); for u=1:n_aw if aw_nav(u)>0 && aw_com(u)>0 % first quadrant class_aw(u,1)=1; elseif aw_nav(u)>0 && aw_com(u)<=0 % second quadrant class_aw(u,1)=2; elseif aw_nav(u)<=0 && aw_com(u)>0 % forth quadrant class_aw(u,1)=4; elseif aw_nav(u)<=0 && aw_com(u)<=0 % third quadrant class_aw(u,1)=3; end end prop_aw=histcounts(class_aw)*100/n_aw; prop_an=histcounts(class_an)*100/n_an; y=[prop_aw; prop_an]; y=y'; %% plotting red =[0.8500,0.3250, 0.0980]; blue=[0,0.4470,0.7410]; figure(1); set(gcf,'Position',[200 200 100 100]) b=bar(prop_aw); b.EdgeColor=blue; b.FaceColor=blue; b.LineWidth =1.0; b.FaceAlpha = 0.2; b.BarWidth=0.75; xlim([0.25 4.75]) ylabel('% units') xticklabels({'I','II','III','IV'}); set(gca, 'box', 'off') set(gca, 'Color','none') set(gca,'linewidth',1);set(gca,'fontsize',8); figure(2); set(gcf,'Position',[400 200 100 100]) b=bar(prop_an); b.EdgeColor=red; b.FaceColor=red; b.LineWidth =1.0; b.FaceAlpha = 0.2; b.BarWidth=0.75; xlim([0.25 4.75]) ylabel('% units') xticklabels({'I','II','III','IV'}); set(gca, 'box', 'off') set(gca, 'Color','none') set(gca,'linewidth',1);set(gca,'fontsize',8); %% save units # and their respective quadrant classification % looking for the units # load('all_data.mat') eq_=all_di(:,2)==0; aw_=all_di(:,3)==0; an_=all_di(:,3)==1; cell_aw=all_di(logical(eq_.*aw_),1); cell_an=all_di(logical(eq_.*an_),1); cell_aw=[cell_aw, class_aw]; load('pt_data.mat') eq_=all_di(:,2)==0; an_=all_di(:,3)==1; cell_pt=all_di(logical(eq_.*an_),1); cell_an=[cell_an; cell_pt]; cell_an=[cell_an, class_an]; mode_aw=mode(class_aw); mode_an=mode(class_an); cell_mode_aw=cell_aw(cell_aw(:,2)==mode_aw,1); % spikes_cluster3/ cell_mode_an=cell_an(cell_an(:,2)==mode_an,1); % spikes_cluster5/ and 6/ and 8/ save('cell_an.mat', 'cell_an') save('cell_aw.mat', 'cell_aw')