Sorry we missed this question. The problem is that colon expression lengths are tricky business in MATLAB because the end point of a:b:c is not required to equal a + n*b for any integer n, and the situation is even more complicated with non-integer or extremely large values when there can also be round-off error. Try replacing
temp = txSig(i*15+1:15*(i+1),1);
temp = txSig(i*15+(1:15),1);
The latter makes it crystal clear that the indexing expression is 15 elements long. You shouldn't need the if/else, as that should work perfectly when i == 0.