0001 function [t_out,p_out,mn1,mn2]=calc_tstat_scl(scl1,scl2,pair_samp);
0002
0003
0004
0005
0006
0007
0008
0009 if nargin<3
0010 pair_samp=0;
0011 end
0012
0013
0014 [dim1,dim2,nmstm_1]=size(scl1);
0015 [dim1,dim2,nmstm_2]=size(scl2);
0016
0017 t_out=zeros(dim1,dim2);
0018 p_out=ones(dim1,dim2);
0019
0020 mn1=mean(scl1,3);
0021 mn2=mean(scl2,3);
0022 for i=1:dim1
0023 for j=1:dim2
0024 d1=scl1(i,j,:);
0025 d2=scl2(i,j,:);
0026 d1=reshape(d1,nmstm_1,1);
0027 d2=reshape(d2,nmstm_2,1);
0028 in1=d1;
0029 in2=d2;
0030 if pair_samp==1
0031 [t,p]=ttest_pair(d1,d2);
0032 else
0033 [h,p,ci,stats]=ttest2(d1,d2);
0034 t=stats.tstat;
0035 end
0036 p_out(i,j)=p;
0037 t_out(i,j)=t;
0038 end
0039 end