function P = sft(ssfn) if nargin<1, ssfn = 'ssfn.txt'; end fid = fopen(ssfn); N = 12; Q = zeros(N); C = zeros(N); S = zeros(N); A = zeros(N); while 1, tline = fgetl(fid); if ~ischar(tline), break; end id = [strfind(tline,' ') strfind(tline,':')]; t1 = str2num( tline(2:id(1)-1) ); t2 = str2num( tline(id(1)+2:id(2)-1) ); s1 = str2num( tline(id(2)+1:id(3)-1) ); s2 = str2num( tline(id(3)+1:end) ); Q(t1,t2) = Q(t1,t2) + s1-s2; C(t1,t2) = C(t1,t2) + 1; S(t1,t2) = S(t1,t2) + sign(s1-s2); end fclose(fid); % ---------------------------------------------------- for i = 1:N, for j = i+1:N, if C(i,j)>0, if S(i,j)==0, if Q(i,j)==0, A(i,j) = 1; elseif Q(i,j)>0, S(i,j) = 1; else S(i,j) =-1; end end if S(i,j)~=0, if Q(i,j)/C(i,j)>2, d = 1; elseif Q(i,j)/C(i,j)<0, d = -1; else d = 0; end if S(i,j)>0, A(i,j) = min(S(i,j)*2,9) + d; else A(i,j) = 1/[min(abs(S(i,j))*2,9) + d]; end end if A(i,j)~=0, A(j,i) = 1/A(i,j); end end end end % ---------------------------------------------------- ki = [1]; done = 0; while ~done, flag = 0; for t = ki, z = find(A(t,:)); if ~isempty(setdiff(z,ki)), ki = union(ki, z); flag = 1; end end done = [length(ki)==N | flag==0]; end if length(ki)