Borrar filtros
Borrar filtros

How to remove identical pair of data from a matrix in MATLAB?

1 visualización (últimos 30 días)
Abhiram B R
Abhiram B R el 11 de Mayo de 2021
Comentada: Jonas el 11 de Mayo de 2021
I have a Nx2 matrix with identical pairs. Something like this:
b_data = [ 1 2; 3 4; 7 10; 2 1; 10 7; 11 12];
i consider 1 2, 2 1 as identical
I need to make this
b_data = [1 2; 3 4;7 10; 11 12];
Is there any command for doing so?

Respuesta aceptada

Jonas
Jonas el 11 de Mayo de 2021
use something like
unique(sort([1 2; 2 1; 3 5],2),'rows')
  4 comentarios
Rik
Rik el 11 de Mayo de 2021
Ah, sorry, I must have read it too quickly. Have an upvote as an apology.
Jonas
Jonas el 11 de Mayo de 2021
no problem, i also often read faster than i can think ;)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by