% creates Figures {1,...,10} function MakeFigs_2_11 ROOT=cd; saveFigure=1; % do I save the figure? % 3rd party: % freezeColors -> http://www.mathworks.com/matlabcentral/fileexchange/7943-freezecolors-unfreezecolors % barweb -> http://www.mathworks.com/matlabcentral/fileexchange/10803 addpath(genpath('3rdparty')) % fig='figure/'; %%%%%%%%%%%%%%%%%%%%%%% % Fig 2: Elevation % Fig 3: Length COP (Dominant) % Fig 4: (Not dominant) % Fig 5: Area COP (Dominant) % Fig 6: (Not dominant) % Fig 7: DPSI _3s_10_s (Dominant) % Fig 8: (Not dominant) % Fig 9: contact time % Fig 10: visual reaction time % Fig 11: acoustic reaction time %%%%%%%%%%%%%%%%%%%%%%% % load data load('data_new.mat') % prima data.mat PAR = 8:27; % NB: parameters goes from column 8 to column 27 Label_Par = data(1,PAR); DATA=cell2mat(data(2:end,PAR)); DATAb=DATA; Labels=data(2:end,1); LabN = grp2idx(Labels); % Numeric vector (10 values) L = {'A.C. Siena - Serie A' % A 'Empoli F.C. - Serie B' % B 'A.C. Pisa 1909 - Lega Pro 1a Divisione ' % C 'U.S. Poggibonsi - Lega Pro 2a Divisione' % D 'U.S. Forcoli Calcio 1921 - Serie D' % E 'A.S.D. Colle - Eccellenza' % F 'Volterrana calcio - Promozione' % G 'A.C.D. Geotermica - 1a Categoria' % H 'U.S.D. Pomarance - 2a Categoria' % I 'A.S.C. Villamagna - 3a Categoria' % L 'Control' }; % X NCat = {'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'L' 'X'}; LN=grp2idx(L); idx=cell(1,numel(LN)); IDX_NUM=zeros(numel(LN),1); for iL=1:numel(LN) idx{iL}=find(strcmp(data(2:end,1),L{LN(iL)})); IDX_NUM(iL)=numel(idx{iL}); end for fig = 2:11 switch fig case 2 %% Fig 2: figure(2) iP=17; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'Elevation'; StUnits = 'cm'; case 3 %% Fig 3: figure(3) iP=1; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'COP length (Dominant)'; StUnits = 'mm'; case 4 %% Fig 4: figure(4) iP=6; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'COP length (Non Dominant)'; StUnits = 'mm'; case 5 %% Fig 5: figure(5) iP=3; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'COP Area (Dominant)'; StUnits = 'mm^2'; case 6 %% Fig 6: figure(6) iP=8; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'COP Area (Non Dominant)'; StUnits = 'mm^2'; case 7 %% Fig 7: figure(7) iP=[11,13]; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp; nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,[1,2])'; ERRs = Xbp(:,[3,4])'; StERRs = (ERRs./sqrt(repmat(IDX_NUM,1,2))'); GROUPs={'3s' '10s'}; TITLE = 'DPSI (Dominant)'; StUnits = 'mm'; case 8 %% Fig 8: figure(8) iP=[14,16]; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp; nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,[1,2])'; ERRs = Xbp(:,[3,4])'; StERRs = (ERRs./sqrt(repmat(IDX_NUM,1,2))'); GROUPs={'3s' '10s'}; TITLE = 'DPSI (Non Dominant)'; StUnits = 'mm'; case 9 %% Fig 9: figure(9) iP=18; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'Contact Time'; StUnits = 's'; case 10 %% Fig 10: figure(10) iP=19; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'Visual Reaction Time'; StUnits = 's'; case 11 %% Fig 11: figure(11) iP=20; Xbp=[]; for iL=1:numel(LN) Xbp=[Xbp;nanmean(DATA(idx{iL},iP)),nanstd(DATA(idx{iL},iP))]; end MEASs = Xbp(:,1); ERRs = Xbp(:,2); StERRs = ERRs./sqrt(IDX_NUM); GROUPs=[]; TITLE = 'Acoustic Reaction Time'; StUnits = 's'; end set(gcf,'renderer','painters') Colors=colormap(copper(numel(idx))); if size(ERRs,2)==1 % single barplot subplot(2,2,1:2) h = barweb(MEASs, ERRs, 0.8, GROUPs, TITLE, [], [], Colors, [], cell(size(NCat)), 1, 'axis'); set(gca,'FontSize',20) set(gca, 'box', 'on'); freezeColors % subplot(2,2,3) hold on NumSamples = zeros(1,numel(idx)); for iL=1:numel(idx) NumSamples(iL)=numel(idx{iL}); line([MEASs(iL)-1.96*StERRs(iL) MEASs(iL)+1.96*StERRs(iL)], ... [-iL -iL]+numel(idx)+1, 'LineWidth', 3,'Color',Colors(iL,:)) plot(MEASs(iL), -iL+numel(idx)+1,'marker','+','markersize',6,'Color',Colors(iL,:)) line([MEASs(iL)-1.96*StERRs(iL) MEASs(iL)+1.96*StERRs(iL)], ... [-iL -iL]+numel(idx)+1, 'LineWidth', 0.5,'Color','k') end set(gca,'yticklabel',fliplr(NCat)) set(gca,'ytick',1:numel(idx)) set(gca, 'box', 'on'); set(gca,'FontSize',20) xlabel(['$$' StUnits '$$'], 'fontsize',15,'interpreter','latex','FontWeight','bold'); ylim([0 12]) xlim([min(MEASs-ERRs) max(MEASs+ERRs)]) freezeColors % subplot(2,2,4) pValues=combinedTests(NCat,data,PAR(1)+iP-1); dlmcell([fig,TITLE,'_pValuesTT.txt'],pValues); set(gca,'XTick',1:11) set(gca,'YTick',1:11) set(gca,'yticklabel',NCat) set(gca,'FontSize',20,'FontWeight','bold') set(gca, 'box', 'on'); % set(gcf, 'Color', [1 1 1],'PaperSize',[29.681205808 41.948713346]) % else % multiple barplot subplot(4,2,1:4) h = barweb(MEASs, ERRs, 0.8, GROUPs, TITLE, [], [], Colors, [], cell(size(NCat)), 1, 'axis'); set(gca,'FontSize',20) set(gca, 'box', 'on'); freezeColors % for iR=1:2 % there are two parameters subplot(4,2,5+iR-1) MEASs_ = MEASs(iR,:); ERRs_ = ERRs(iR,:); StERRs_ = StERRs(iR,:); hold on NumSamples = zeros(1,numel(idx)); for iL=1:numel(idx) NumSamples(iL)=numel(idx{iL}); line([MEASs_(iL)-1.96*StERRs_(iL) MEASs_(iL)+1.96*StERRs_(iL)], ... [-iL -iL]+numel(idx)+1, 'LineWidth', 3,'Color',Colors(iL,:)) plot(MEASs_(iL), -iL+numel(idx)+1,'marker','+','markersize',6,'Color',Colors(iL,:)) line([MEASs_(iL)-1.96*StERRs_(iL) MEASs_(iL)+1.96*StERRs_(iL)], ... [-iL -iL]+numel(idx)+1, 'LineWidth', 0.5,'Color','k') end set(gca,'yticklabel',fliplr(NCat)) set(gca,'ytick',1:numel(idx)) set(gca, 'box', 'on'); set(gca,'FontSize',20) xlabel(['$$' StUnits '$$'], 'fontsize',15,'interpreter','latex','FontWeight','bold'); ylim([0 12]) xlim([min(MEASs_-ERRs_) max(MEASs_+ERRs_)]) freezeColors % subplot(4,2,7+iR-1) pValues=combinedTests(NCat,data,PAR(1)+iP(iR)-1); dlmcell([fig,TITLE,GROUPs{iR},'_pValuesTT.txt'],pValues); set(gca,'XTick',1:11) set(gca,'YTick',1:11) set(gca,'yticklabel',NCat) set(gca,'FontSize',20,'FontWeight','bold') set(gca, 'box', 'on'); % set(gcf, 'Color', [1 1 1],'PaperSize',[29.681205808*2 41.948713346]) % end % end if saveFigure cd('figure') saveas(gcf,sprintf('figure%d.fig', fig)) orient landscape saveas(gcf,sprintf('figure%d.png', fig)) cd(ROOT) close(gcf) end end