using unique function on column 2 and keep first col

2 Ansichten (letzte 30 Tage)
asdasd
asdasd am 14 Dez. 2012
Hi sorry for this simple question
G =
1 2
1 3
1 5
5 10
6 10
8 13
9 13
10 13
12 13
13 14
unique(G(:,2));
result :
ans =
2
3
5
10
13
14
i want it to bring the first column with it like this and save it in same array or another new array
G =
1 2
1 3
1 5
5 10
8 13
13 14
Thanks

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 14 Dez. 2012
Bearbeitet: Azzi Abdelmalek am 14 Dez. 2012
[c,idx]=unique(G(:,2)
out=G(idx,:)

Weitere Antworten (1)

asdasd
asdasd am 14 Dez. 2012
Thank you so much azzi

Kategorien

Mehr zu Numeric Types finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by