Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Removing specific rows from a matrix
Date: Wed, 21 Jan 2009 16:59:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 24
Message-ID: <gl7k8m$oce$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232557142 24974 172.30.248.37 (21 Jan 2009 16:59:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 21 Jan 2009 16:59:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1663622
Xref: news.mathworks.com comp.soft-sys.matlab:512975


I have a pretty simple question, but I can't figure out the coding for it.

I have a 12,300 x 12 matrix. I want to code something up that will delete rows that match up based on values in the matrix. I want it to compare the first and second row, based on the values in column one and column two and if they match I want one of the rows deleted. However, I also want it to delete rows that have the sum of columns 3:12 greater than a specified value.

basically...

A =

...
3.4 5.6 10 10 10 10 10 10 10 10 10 10 %row 80
3.4 5.6 10 10 10 10 10 10 10 10 10 10 
3.2 5.3 100 100 100 100 100 100 100 100 100 100
...

I want the code to run through each row - see that rows 80 and 81 match based on the first two values and then delete either row 80 or 81 and then see that in row 82 the sum of the last 10 columns is greater than 200 so it will delete that row also. The matching based on the first two columns will always occur consecutively if that helps with the coding. I.E the matches will always be in consecutive rows 85 & 86 or 190 & 191.

I want the final output to just be

A=
...
3.4 5.6 10 10 10 10 10 10 10 10 10 10 %row 80
...

Any help will be greatly appreciated. I know it may not be very clear, if anyone needs a better explanation, post and I will try my best to clear up any confusion.