Hi all,
I'm writing a simple script in Matlab where I compare adjacent element and delete one of them if there difference between them is one.
for i=1:length(Vector) - 1if Vector(i+1) - Vector(i) == 1 Vector(i) = [];end if i == length(Vector) break end
However, I'm getting an error that my indices are out of bound. Is there a simpler way of doing this by utilizing internal functions. I think my problem is that my array is constantly decreasing and the Vector(i+1) – Vector(i) are out of bounds.
Best Answer