Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to find maximum values in a matrix
Date: Wed, 24 Dec 2008 22:53:01 +0000 (UTC)
Organization: Umea University
Lines: 76
Message-ID: <giuegd$noo$1@fred.mathworks.com>
References: <giu681$21u$1@fred.mathworks.com> <9rx4l.15441$ZP4.9441@nlpi067.nbdc.sbc.com> <giuamh$q9o$1@fred.mathworks.com> <B9y4l.15443$ZP4.6360@nlpi067.nbdc.sbc.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 1230159181 24344 172.30.248.37 (24 Dec 2008 22:53:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 24 Dec 2008 22:53:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 884938
Xref: news.mathworks.com comp.soft-sys.matlab:508704

"Nasser Abbasi" <nma@12000.org> wrote in message <B9y4l.15443$ZP4.6360@nlpi067.nbdc.sbc.com>...
> 
> "Abdul " <spacian1@hotmail.com> wrote in message 
> news:giuamh$q9o$1@fred.mathworks.com...
> > Dear Naseer,
> >
> > Thanks for the reply,
> > but the programme u have told is not working, i don't know why.
> > can u please give some more help to solve it?
> > regards
> >
> 
> You must have typed something wrong in copying it?  It works just fine on my 
> Matlab 2008b and here it is again below.
> 
> What exactly is the error you got? Post everything you typed and the error 
> message
> 
> >>
--> >> clear all;
> >> A= [1218 198
> >>       1218 22
> >>       1218 1441
> >>       1218 28
> >>       1219 34
> >>       1219 1789];
> >>
> >> B=sortrows(A,-2);
> >> [v,I]=unique(B(:,1),'first');
> >> B(I,:)
> >>
> >> ans =
> >>         1218        1441
> >>         1219        1789
> >>
> 
> 
> --Nasser 
> 
Hi Naseer,

After running the program through M-file (trial.m), it gives all below with error message:

echo on
A=[1218,198;1218,22;1218,1441;1218,28;1219,34;1219,1789]

A =

        1218         198
        1218          22
        1218        1441
        1218          28
        1219          34
        1219        1789

B=sortrows(A,-2)

B =

        1219        1789
        1218        1441
        1218         198
        1219          34
        1218          28
        1218          22

[v,I]=unique(B(:,1),'first')
??? Error using ==> unique
Unknown flag.

Error in ==> trial at 6
[v,I]=unique(B(:,1),'first')

Regards and thanks a lot,

Abdul