function n=findmaxg(x);
g=find(x(:)~=nan);
n=g(find(x(g)==max(x(g))));
