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
vector([1:k-1 k+1:end]) will do. Depending on the other operations, there may be a better way to handle this, though.
vector([1:k-1 k+1:end])
For completeness, if you want to remove one element, you do not need to go the vector = vector([1:k-1 k+1:end]) route, you can use vector(k)=[];
vector = vector([1:k-1 k+1:end])
vector(k)=[];