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]

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2016년 1월 26일

1 개 추천

idx = fliplr([true, diff(fliplr(p))~=0]);
out = find(idx);

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

제품

태그

질문:

2016년 1월 26일

댓글:

2016년 1월 26일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by