function ix = findmax(indx, s)
[m,ix] = max(s(indx));
ix = indx(ix);