p = [90 90 -45 0 0 45 45 0 -45]; q = p; q(1+find(q(1:end-1)==q(2:end))) = []; q = [90 -45 0 45 0 -45]; idx = [true diff(p)~=0]; q = p(idx);
i want to find positions of q according to p from right to left. Means [2 3 5 7 8 9]
MATLAB
p = [90 90 -45 0 0 45 45 0 -45]; q = p; q(1+find(q(1:end-1)==q(2:end))) = []; q = [90 -45 0 45 0 -45]; idx = [true diff(p)~=0]; q = p(idx);
Best Answer