for loop max index

change length(other matrix) to length(t)