selecting unique rows
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have an matrix of 6 columns,all columns have repeated numbers,now i want to select only unique values of that matrix ,please help
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 18 Jan. 2012
EDIT [23:27(UTC+4) 18.01.2012]
a = [1 2 7 8 9 0
2 2 71 2 4 1];
out0 = a(all(diff(sort(a,2),1,2) > 1e4*eps,2),:)
out1 = sortrows(out0);
loc = [true;all(diff(out1,1,1),2)];
out = out1(loc,:);
Weitere Antworten (2)
Wayne King
am 18 Jan. 2012
C = unique(A,'rows');
Selects the unique rows of the matrix A in sorted order. Is that what you mean?
6 Kommentare
Andrei Bobrov
am 18 Jan. 2012
a = [1 2 7 8 9 0
2 2 71 2 4 1];
out = a(all(diff(sort(a,2),1,2) > 1e4*eps,2),:)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!