function [Hc t1 inext indexes] = local(ilocal,H,t,type,nextindex)
    if type(ilocal) == 1
        indexes = ilocal+1:nextindex(ilocal);
        Hc = H(indexes);
        t1 = t(indexes);        
    elseif type(ilocal) == 2
        indexes = nextindex(ilocal);
        Hc = H(indexes);
        t1 = t(indexes);
    end
    inext = nextindex(ilocal);
end