The error is straightforward — the first and second argument vectors must be the same length. They can be different sizes, so one can be a row vector and the other a column vector, however they must have the same numbers of elements.
From your code, it appears that they should be, so we would have to have your data to see what the problem is.