Your 4 vectors have a length less than 20. Before the loop put this, and you'll see (in the command window)
Do they all go up to 20? No, evidently not or you wouldn't be getting an error message. If you still need help, attach your xi, xj, yi, and yj.