Borrar filtros
Borrar filtros

Searching on a vector of vector

1 visualización (últimos 30 días)
nedo nodo
nedo nodo el 14 de Nov. de 2012
Hi,
I have a question about searching on a vector of vector. Each element of the first vector is a vector of value. The elements of the outer vector can be duplicated. I have to find a new representation in which there are no duplicates. How can I do it in efficient way?
Example
X=[0,1,0;0,1,1;0,1,0] -> Xnew=[0,1,0;0,1,1] where the first element has value two and the second one.
Thank
  1 comentario
Jan
Jan el 14 de Nov. de 2012
Editada: Jan el 14 de Nov. de 2012
A "vector of vectors" is called "matrix.
To find an "efficient" method, we need to know the typical size of the problem. It matters if you want to do this millions of times for a [12 x 3] matrix, or 12 times for a [1e6 x 3] matrix.

Iniciar sesión para comentar.

Respuestas (1)

Andrei Bobrov
Andrei Bobrov el 14 de Nov. de 2012
Xnew = unique(X,'rows');

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by