bug fix when ((n+1)*100)~=size(newmatrix,1)