Clear Filters
Clear Filters

Help for data in txt file

1 view (last 30 days)
Ferial Assmani
Ferial Assmani on 24 Mar 2016
Edited: Stephen23 on 26 Mar 2016
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

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 24 Mar 2016
Edited: Azzi Abdelmalek on 24 Mar 2016
use unique function
b=[2;3;3;1]
a=unique(b)
  3 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 26 Mar 2016
yes, but if you want to use unique function without sorting
c=unique(b,'stable')
Stephen23
Stephen23 on 26 Mar 2016
Edited: Stephen23 on 26 Mar 2016
@Ferial Assmani: The output of unique is sorted by default, as the documentation clearly states.

Sign in to comment.

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!