Borrar filtros
Borrar filtros

compare a group of data

1 visualización (últimos 30 días)
zhiping
zhiping el 9 de Jun. de 2011
I want to compare a group of data, try to delete the same element, and then output the data unique. For example, I have many groups of data, like u(:,1),u(:,2),u(:,3)... I only compare the first number of every group, if the numbers are equal, I output the whole group of numbers. First of all, I want to use 'unique', but it seems not what I want,any idea? thanks in advance u(:,1)=[1 2 3 6 8],u(:,2)=[8 9 6 5 3 ],u(:,3)=[1 2 3 6 8], u(:,4)=[ 4 5 6 9 8], u(:,5)=[7 6 4 7 3]... Through comparing the first number of every group, I delete u(:,1) or u(:,3) and then output the other three group.
  1 comentario
Sean de Wolski
Sean de Wolski el 9 de Jun. de 2011
Please provide a small example of inputs/operation/output

Iniciar sesión para comentar.

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 9 de Jun. de 2011
unique(u.','rows').';
transpose and use the rows option, then retranspose
If you don't want it sorted:
[~,idx] = unique(u','rows');
u(:,idx)

Más respuestas (0)

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