Path: news.mathworks.com!not-for-mail
From: "Ian Clarkson" <ian.clarkson@gesturetek.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help: Finding 2nd max value index
Date: Thu, 10 Jan 2008 14:19:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <fm59gm$n9l$1@fred.mathworks.com>
References: <fm52p2$lid$1@fred.mathworks.com> <16045218.1199972757574.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: "Ian Clarkson" <ian.clarkson@gesturetek.com>
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 1199974742 23861 172.30.248.37 (10 Jan 2008 14:19:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 10 Jan 2008 14:19:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1215962
Xref: news.mathworks.com comp.soft-sys.matlab:445198


Dan <dan_ang_25@yahoo.com> wrote in message 
<16045218.1199972757574.JavaMail.jakarta@nitrogen.mathforum.org>...
> a = randint(3,10,[1 8]) % data
> n = 2; % order
> mnd = blkproc(a,[1 size(a,2)],@(x) maxnd(x,n))
> 
> Sorry, i do not understand this code. how should i 
decipher it. sorry i am very new to matlab. i am still at 
the learning stage. can u explain to me

Dan, I suggest you use MATLAB's extensive 'help' command. 
If you don't understand the blkproc function, just type 
'help blkproc' at the prompt. In fact, before reading this 
thread, I didn't understand it either, and now I can see 
exactly how it works by using the help function.

In words, it goes through a matrix and finds the second 
highest value in every row. The blkproc function call could 
be replaced with a for loop going through every row to find 
the second highest value, but I'm guessing it's more 
efficient (and elegant) to take this approach.