0001 function powerfname = make_outputfname(csdmfname,output_type) 0002 0003 for i = 2:size(csdmfname,1) 0004 subj_check(i) = strcmp(csdmfname(1,1:3),csdmfname(i,1:3)); 0005 group_check(i) = strcmp(csdmfname(1,5:5),csdmfname(i,5:5)); 0006 cnd1(i) = strcmp(csdmfname(1,7:7),csdmfname(i,7:7)); 0007 cnd2(i) = strcmp(csdmfname(1,8:8),csdmfname(i,8:8)); 0008 cnd3(i) = strcmp(csdmfname(1,9:9),csdmfname(i,9:9)); 0009 cnd4(i) = strcmp(csdmfname(1,10:10),csdmfname(i,10:10)); 0010 cnd5(i) = strcmp(csdmfname(1,11:11),csdmfname(i,11:11)); 0011 ref_check(i) = strcmp(csdmfname(1,13:16),csdmfname(i,13:16)); 0012 end; 0013 iff = 1; 0014 if sum(subj_check) == size(csdmfname,1) - 1 0015 powerfname(1,iff:iff+3) = [csdmfname(1,1:3) '_']; 0016 iff = iff +4; 0017 end 0018 if sum(group_check) == size(csdmfname,1) - 1 0019 powerfname(1,iff:iff+1) = [csdmfname(1,5) '_']; 0020 iff = iff+2; 0021 end; 0022 if (sum(cnd1) == size(csdmfname,1) - 1) & (csdmfname(1,7) ~= 0) 0023 powerfname(1,iff) = [csdmfname(1,7)]; 0024 iff = iff+1; 0025 end; 0026 if (sum(cnd2) == size(csdmfname,1) - 1) & (csdmfname(1,8) ~= 0) 0027 powerfname(1,iff) = [csdmfname(1,8)]; 0028 iff = iff + 1; 0029 end 0030 if (sum(cnd3) == size(csdmfname,1) - 1) & (csdmfname(1,9) ~= 0) 0031 powerfname(1,iff) = [csdmfname(1,9)]; 0032 iff = iff + 1; 0033 end 0034 if (sum(cnd4) == size(csdmfname,1) - 1) & (csdmfname(1,10) ~= 0) 0035 powerfname(1,iff) = [csdmfname(1,10)]; 0036 iff = iff + 1; 0037 end 0038 if (sum(cnd5) == size(csdmfname,1) - 1) & (csdmfname(1,11) ~= 0) 0039 powerfname(1,iff) = [csdmfname(1,11)]; 0040 iff = iff + 1; 0041 end 0042 if sum(ref_check) == size(csdmfname,1) - 1 0043 powerfname(1,iff:iff+4) = ['.' csdmfname(1,13:16)]; 0044 end; 0045 if strcmp(output_type,'power') 0046 powerfname = [powerfname '.pow']; 0047 elseif strcmp(output_type,'phase') 0048 powerfname = [powerfname '.pha']; 0049 elseif strcmp(output_type,'coherence') 0050 powerfname = [powerfname '.coh']; 0051 else 0052 disp('unknown type no type flag appended') 0053 end; 0054 0055