Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!feeder.erje.net!feeder.news-service.com!aioe.org!.POSTED!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Complex Matrix Row Deletion Date: Sun, 17 Jul 2011 14:17:27 -0500 Organization: Aioe.org NNTP Server Lines: 57 Message-ID: <ivvcg5$g3p$1@speranza.aioe.org> References: <ivv7va$kan$1@newscl01ah.mathworks.com> NNTP-Posting-Host: FGNBBs2liw79ilBNuWbWGw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.mathworks.com comp.soft-sys.matlab:736550 On 7/17/2011 1:00 PM, curoch wrote: > Hi all, > > My problem is as follows: > > - I have a large matrix which may be exemplified in the following > manner > > A = [1 1 23 > 1 1 24 ... > 2 -1 4 ] > - My aim is to analyse the elements in the third column for each set > where the values in column 1 and 2 are equal. i > - Upon analysing, I need to delete the row which has the smallest value > in column 3. > > For example, applying this to matrix A > > The first set is [ 1 1 23 > 1 1 24] hence deleting the first row >> idx=A(:,1)==A(:,2); >> z=A(idx,3) z = 23 24 >> A(idx(1),:)=[] A = 1 1 24 1 -1 34 1 -1 45 2 1 77 2 1 12 2 -1 4 >> > > Matrix A thus becomes > > A = [ 1 1 23 > 1 -1 34 > 2 1 12 > 2 -1 4] > ... I don't see the above from the description and the matrix given but perhaps the previous manipulations will be of some benefit in selecting and deselecting desired rows, etc., ... --