Removing Reverse Rows in a Permutation Matrix in Matlab

I'm looking for a quick way in Matlab to do the following:
Given a permutation matrix of a vector, say [1 2 3], I would like to remove all duplicate reverse rows.
So the matrix P=perms([1 2 3])
3 2 1
3 1 2
2 3 1
2 1 3
1 3 2
1 2 3
becomes
3 2 1
3 1 2
2 3 1

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 15 de Sept. de 2020
Editada: KALYAN ACHARJYA el 15 de Sept. de 2020
P=perms([1 2 3]);
result=P(unique(P(:,2)),:)
result =
3 2 1
3 1 2
2 3 1

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Sept. de 2020

Editada:

el 15 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by