From: Sean on 21 May 2010 08:30 "ratnesh kumar" <iam_ratnesh(a)yahoo.co.in> wrote in message <ht5nh0$mou$1(a)fred.mathworks.com>... > hi , > i have to remove rows those have repeated with same elements in the matrix. > suppose > v =[1 1 11 > 1 2 10 % (1) > 1 3 9 > 1 4 8 > 1 5 7 > 1 6 6 > 2 1 10 % here is repeatition (1) with same elements > 2 2 9 > 2 3 8 > 2 4 7 > 2 5 6 > 3 1 9 > 3 2 8 > 3 3 7 > 3 4 6 > 3 5 5 > 4 1 8 > 4 2 7 > 4 3 6 > 4 4 5 > 5 1 7 > 5 2 6] > similarly some others are also repeating > final matrix is like > V=[1 1 11 > 1 2 10 > 1 3 9 > 1 4 8 > 1 5 7 > 1 6 6 > 2 2 9 > 2 3 8 > 2 4 7 > 2 5 6 > 3 3 7 > 3 4 6 > 3 5 5 > 4 4 5] > how it is possible iam trying unique but not getting the indesired results. Try this: >>uniqueV = unique(sort(V')','rows'); Algorithm: -transpose and sort so the members of each column are the same order -transpose again so the sorted columns are once again rows -unique() rows
|
Pages: 1 Prev: finding the boundary points with their coordinates Next: "median" command acting improperly |