Hy all, i have a txt file in which i stock some integers in brute manner, i need to create a copy of this file but i stock my integer in decrase order with no repitition, forme example: A.txt
2
3
3
1
B.txt
1
2
3
Please healpe my

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 24 Mar 2016
Modifié(e) : Azzi Abdelmalek le 24 Mar 2016

0 votes

use unique function
b=[2;3;3;1]
a=unique(b)

3 commentaires

Very helpful, as i see is not necessary to use sort option
c = sort(unique(b));
is it right ?
yes, but if you want to use unique function without sorting
c=unique(b,'stable')
Stephen23
Stephen23 le 26 Mar 2016
Modifié(e) : Stephen23 le 26 Mar 2016
@Ferial Assmani: The output of unique is sorted by default, as the documentation clearly states.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by