Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Complex Matrix Row Deletion Date: Mon, 18 Jul 2011 16:37:08 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 41 Message-ID: <j01nfk$gkh$1@newscl01ah.mathworks.com> References: <ivv7va$kan$1@newscl01ah.mathworks.com> <ivvtms$dil$1@newscl01ah.mathworks.com> <j01kr9$93u$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-05-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1311007028 17041 172.30.248.37 (18 Jul 2011 16:37:08 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Mon, 18 Jul 2011 16:37:08 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:736623 "curoch" wrote in message <j01kr9$93u$1@newscl01ah.mathworks.com>... > ...... > B = [ 1 1 123 > 1 1 434 > 1 1 111 > 1 -1 434 > 1 -1 666 > 2 1 12 > 2 -1 44 > 2 -1 33 ] > ...... > Upon successful completion, matrix B will take the following appearance > > B = [ 1 1 111 > 1 -1 434 > 2 1 12 > 2 -1 33] > ......... > 6. As a last point, in each set, there are only one possibility when column 1 does not equal column 2. > > For instance, the matrix can never take the following form > > D = [ 12 0.5 1 > 12 0.5 2 > 12 1 3 > 12 10 4] > ........ - - - - - - - - - - A = sortrows(A); [~,m] = unique(A(:,1:2),'rows','first'); A = A(m,:); Notes: 1. The first line with 'sortrows' will alter the order of the rows if they are not already in lexicographic order. 2. If your elements are of fractional form, such as the 2.321 of your example, the comparison of elements done by 'unique' nevertheless requires exact equality. Two numbers can display as 2.321 and yet not be exactly equal, perhaps differing only in the least few bits. 3. I could not make sense of your point 6. I don't understand what there is about the form of example D that your matrix can never take. Roger Stafford