Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Unsort values
Date: Fri, 30 Jan 2009 02:24:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <gltoc1$hcg$1@fred.mathworks.com>
References: <gltkg9$je4$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233282241 17808 172.30.248.35 (30 Jan 2009 02:24:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 30 Jan 2009 02:24:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:514868

"Patrick Wang" <chris00558800@hotmail.com> wrote in message <gltkg9$je4$1@fred.mathworks.com>...
> Hi
> 
> I was asked to implement an automatically zoom in feature in my lab, and I have figure out that I can sort my values, and delete the top few numbers and then apply max value to find the coordinate of the fifth largest value, and thus I can set my new x window limit. However, I do not know how to place the sorted array back into the original array, and I do not find "unsort" such command.
> The following is my code:
> 
> RPSDBsort = sort(reversed_Power,'descend');
> RPSDBsort(1:5) = [];
> [y x] = max(RPSDBsort);
> display(RPSDBsort);
> display(x);
> display(y);
> 
> and this would only return me the sorted array of the RPSDBsort, is there anyway that I can delete the biggest five values in the "reversed_Power" array?
> 
> Thank you so much.
> 
> Patrick

  You need the second argument returned by 'sort'.

 [RPSDBsort,p] = sort(reversed_Power,'descend');
 reversed_Power(p(1:5)) = [];

Roger Stafford