Path: news.mathworks.com!newsfeed-00.mathworks.com!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!feeds.phibee-telecom.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!aioe.org!.POSTED!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: sorting and finding the position
Date: Sun, 27 Nov 2011 12:23:57 -0600
Organization: Aioe.org NNTP Server
Lines: 45
Message-ID: <jatv7p$nq8$2@speranza.aioe.org>
References: <jatsag$q6d$1@newscl01ah.mathworks.com> <d9b27dd8-97ad-4e0e-bfee-76e9bf4bce7d@4g2000yqu.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: hSZZtLNLth0wvW/o01CHiQ.user.speranza.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
X-Notice: Filtered by postfilter v. 0.8.2
Xref: news.mathworks.com comp.soft-sys.matlab:750599

On 11/27/2011 11:38 AM, Rune Allnor wrote:
> On 27 Nov, 18:34, "shanas pr"<shana...@gmail.com>  wrote:
>> pls help me
>>
>> I have a series of data with 5 columns and 100 rows
>>
>> what i wan to do is .....to find the maximum value of a specific column let us
>say 5th column and to print the entire row which contain the maximum value (at column 5)????
>>
>> and to repeat the procedure for1000s of rows plz do help
>>
>> for example>>>>>
>>
>>                                      1 2 3 4
>>                                      6 4 5 9
>>                                      2 6 8 0
>>
>> i want to check which is the max value in 4th column?    answer will be 9
>> then i need to print the 2nd row ie.6 4 5 9???
>>
>> thanks in advance...
>

> idx = find (x(:,4)==max(:,4));
> x(idx,:)
>
> Rune

another possibility is the use of the second output
argument to max:

----------------------
[v,I]=max(A(:,4))
A(I,:)

ans =

      6     4     5     9

---------------------

--Nasser