Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Top N values in a multidimensional array
Date: Wed, 29 Oct 2008 18:46:03 +0000 (UTC)
Organization: Universit&#228;t Basel
Lines: 13
Message-ID: <geab1b$1ad$1@fred.mathworks.com>
References: <ge7q06$4k2$1@fred.mathworks.com> <ge7ski$aml$1@fred.mathworks.com> <ge9nu3$cco$1@fred.mathworks.com> <ge9ujq$3m4$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 1225305963 1357 172.30.248.37 (29 Oct 2008 18:46:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 29 Oct 2008 18:46:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870595
Xref: news.mathworks.com comp.soft-sys.matlab:497862


or just...

n = 2; %number of max values

[a,ix] = sort(A(:),'descend');
a = a(1:n);
ix = ix(1:n);

than use ind2sub to find the subscripts.

HTH,
Wolfgang