fnP=@(a,i) (sum(a(i)>a(1:i))+0.5*sum(a(i)==a(1:i)))/i;
>> for i=2:numel(Si),fnP(Si,i),end
ans =
0.75
ans =
0.50
ans =
0.63
>>
To wrap the i==1 special case got more than I could get into the anonymous function in the time I had to play...for general use write a little function--
function P=fnP(A,n)
% Return some undefined P-value estimator from vector A, number elements, n
if n==1
P==1;
else
P=(sum(A(n)>A(1:n)) + 0.5*sum(A(n)==A(1:n)))/n;
end
end