selecting unique rows
Mostrar comentarios más antiguos
I have an matrix of 6 columns,all columns have repeated numbers,now i want to select only unique values of that matrix ,please help
Respuesta aceptada
Más respuestas (2)
TAB
el 18 de En. de 2012
Type
>> doc unique
on your command window
Wayne King
el 18 de En. de 2012
C = unique(A,'rows');
Selects the unique rows of the matrix A in sorted order. Is that what you mean?
6 comentarios
kash
el 18 de En. de 2012
Wayne King
el 18 de En. de 2012
then just unique(A)
kash
el 18 de En. de 2012
Wayne King
el 18 de En. de 2012
I think you need to make your use case clearer, with your above example, show us what you want the output to look like.
kash
el 18 de En. de 2012
Andrei Bobrov
el 18 de En. de 2012
a = [1 2 7 8 9 0
2 2 71 2 4 1];
out = a(all(diff(sort(a,2),1,2) > 1e4*eps,2),:)
Categorías
Más información sobre Shifting and Sorting Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!