A completely different approach using the signal processing toolbox:
groups_of = 335;
as_columns = buffer(x, 2*groups_of);
new_x = reshape(as_columns(1:groups_of, :), 1, );
left_over = mod(length(x), 2*groups_of);
if left_over > 0 && left_over < groups_of
amount_of_padding = groups_of - left_over;
new_x(end-amount_of_padding+1:end) = ;
This arranges x down columns in groups of 670 rows. If x is short of filling up a whole row, then the last row is padded with zeros. Then you keep the first 335 rows, and throw away the second 335 rows. Then re-arrange what is left into a vector.
After that is code to adjust for the possibility that the last column was padded in a way that introduced zeros that were not chopped out yet.
For your particular size, mod(26672,335*2) == 542 so 770-542=228 zeros were added to make even groups of 770. Those extra 228 zeros are all thrown away when you remove the last 335 rows of the matrix that is now 770 x something -- none of the padding zeros ended up left in the top 335 rows of the 770 x something matrix. So for the 26672 size matrix, no trimming out of zeros needs to be done. But in the more general case, it is possible that you had to start padding before the 335 mark, and in that case some trimming would have to be done.
This code relies upon the Signal Processing Toolbox function, buffer(). But you could obviously write equivalent code.. and doing so might even be clearer as you would not need to inject and remove padding.