My question is very similar to this one but I can\'t manage exactly how to apply that answer to my problem.
I am looping through a vector with a variable k
k
Very easy:
newVector = vector([1:k-1 k+1:end]);
This works even if k is the first or last element.