How can i find positions of sorted/unique values.

1 visualización (últimos 30 días)
Triveni
Triveni el 26 de En. de 2016
Comentada: Triveni el 26 de En. de 2016
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]

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 26 de En. de 2016
idx = fliplr([true, diff(fliplr(p))~=0]);
out = find(idx);

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by