[Scilab-users] Remove duplicate rows and sustain original order of rows

CHEZE David 227480 david.cheze at cea.fr
Wed Jun 13 14:00:56 CEST 2018


Hi Iza,

Just consider this tip from the unique help page:

Extracted components, rows or columns can be resorted in their initial order by sorting k:
[N, k] = unique(M);      k = gsort(k,"g",i); N = N(k)
[N, k] = unique(M, "c"); k = gsort(k,"g",i); N = N(:, k)
[N, k] = unique(M, "r"); k = gsort(k,"g",i); N = N(k, :)

Hope it helps,

David


-----Message d'origine-----
De : users <users-bounces at lists.scilab.org> De la part de Izabela Wójcik-Grzaba
Envoyé : mercredi 13 juin 2018 13:44
À : users at lists.scilab.org
Objet : [Scilab-users] Remove duplicate rows and sustain original order of rows

Hi all,

I can't figure out how to remove duplicate rows from the matrix and go back to the original order of rows. Function "unique" with an option "r" 
sorts rows in lexicographic ascending order.

Thanks in advance for any help,
Iza
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list