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$>
References: <gltkg9$je4$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1233282241 17808 (30 Jan 2009 02:24:01 GMT)
NNTP-Posting-Date: Fri, 30 Jan 2009 02:24:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:514868

"Patrick Wang" <> wrote in message <gltkg9$je4$>...
> 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