<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159</link>
    <title>MATLAB Central Newsreader - Sort and revert</title>
    <description>Feed for thread: Sort and revert</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 13 Nov 2008 05:53:54 -0500</pubDate>
      <title>Sort and revert</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159#610634</link>
      <author>fas</author>
      <description>Hi,&lt;br&gt;
I have a vector which I have sorted B=sort(A); Now after changing the&lt;br&gt;
10 values on either end I would like to take the vector back to A.&lt;br&gt;
B=sort(A);&lt;br&gt;
B(1:10)=20;&lt;br&gt;
B(90:100)=70;&lt;br&gt;
Now I want to transform B-&amp;gt;A so that the indexing is same of what my A&lt;br&gt;
was.&lt;br&gt;
&lt;br&gt;
Since its an image I have to revert back to same indexing of vector&lt;br&gt;
only with changed values that I did after sorting.&lt;br&gt;
&lt;br&gt;
Any idea ?</description>
    </item>
    <item>
      <pubDate>Thu, 13 Nov 2008 06:33:02 -0500</pubDate>
      <title>Re: Sort and revert</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159#610639</link>
      <author>Ning </author>
      <description>fas &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &amp;lt;195e56e8-c7b9-49b3-839f-fd0468067e86@35g2000pry.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I have a vector which I have sorted B=sort(A); Now after changing the&lt;br&gt;
&amp;gt; 10 values on either end I would like to take the vector back to A.&lt;br&gt;
&amp;gt; B=sort(A);&lt;br&gt;
&amp;gt; B(1:10)=20;&lt;br&gt;
&amp;gt; B(90:100)=70;&lt;br&gt;
&amp;gt; Now I want to transform B-&amp;gt;A so that the indexing is same of what my A&lt;br&gt;
&amp;gt; was.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Since its an image I have to revert back to same indexing of vector&lt;br&gt;
&amp;gt; only with changed values that I did after sorting.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any idea ?&lt;br&gt;
That's easy. Try help sub2ind first, after you sorted and changed the vector, try help ind2sub.&lt;br&gt;
May it helps. </description>
    </item>
    <item>
      <pubDate>Thu, 13 Nov 2008 06:46:35 -0500</pubDate>
      <title>Re: Sort and revert</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159#610641</link>
      <author>fas</author>
      <description>On Nov 13, 5:33=A0pm, &quot;Ning&quot; &amp;lt;ning.ro...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;195e56e8-c7b9-49b3-839f-fd0=&lt;br&gt;
468067...@35g2000pry.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; I have a vector which I have sorted B=3Dsort(A); Now after changing the&lt;br&gt;
&amp;gt; &amp;gt; 10 values on either end I would like to take the vector back to A.&lt;br&gt;
&amp;gt; &amp;gt; B=3Dsort(A);&lt;br&gt;
&amp;gt; &amp;gt; B(1:10)=3D20;&lt;br&gt;
&amp;gt; &amp;gt; B(90:100)=3D70;&lt;br&gt;
&amp;gt; &amp;gt; Now I want to transform B-&amp;gt;A so that the indexing is same of what my A&lt;br&gt;
&amp;gt; &amp;gt; was.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Since its an image I have to revert back to same indexing of vector&lt;br&gt;
&amp;gt; &amp;gt; only with changed values that I did after sorting.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Any idea ?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; That's easy. Try help sub2ind first, after you sorted and changed the vec=&lt;br&gt;
tor, try help ind2sub.&lt;br&gt;
&amp;gt; May it helps.&lt;br&gt;
&lt;br&gt;
Sorry I could not work sub2ind for my case :(</description>
    </item>
    <item>
      <pubDate>Thu, 13 Nov 2008 06:48:49 -0500</pubDate>
      <title>Re: Sort and revert</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159#610642</link>
      <author>fas</author>
      <description>On Nov 13, 5:33=A0pm, &quot;Ning&quot; &amp;lt;ning.ro...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;195e56e8-c7b9-49b3-839f-fd0=&lt;br&gt;
468067...@35g2000pry.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; I have a vector which I have sorted B=3Dsort(A); Now after changing the&lt;br&gt;
&amp;gt; &amp;gt; 10 values on either end I would like to take the vector back to A.&lt;br&gt;
&amp;gt; &amp;gt; B=3Dsort(A);&lt;br&gt;
&amp;gt; &amp;gt; B(1:10)=3D20;&lt;br&gt;
&amp;gt; &amp;gt; B(90:100)=3D70;&lt;br&gt;
&amp;gt; &amp;gt; Now I want to transform B-&amp;gt;A so that the indexing is same of what my A&lt;br&gt;
&amp;gt; &amp;gt; was.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Since its an image I have to revert back to same indexing of vector&lt;br&gt;
&amp;gt; &amp;gt; only with changed values that I did after sorting.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Any idea ?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; That's easy. Try help sub2ind first, after you sorted and changed the vec=&lt;br&gt;
tor, try help ind2sub.&lt;br&gt;
&amp;gt; May it helps.&lt;br&gt;
&lt;br&gt;
My data is already a vector.</description>
    </item>
    <item>
      <pubDate>Thu, 13 Nov 2008 07:06:09 -0500</pubDate>
      <title>Re: Sort and revert</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159#610643</link>
      <author>Roger Stafford</author>
      <description>fas &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &amp;lt;195e56e8-c7b9-49b3-839f-fd0468067e86@35g2000pry.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I have a vector which I have sorted B=sort(A); Now after changing the&lt;br&gt;
&amp;gt; 10 values on either end I would like to take the vector back to A.&lt;br&gt;
&amp;gt; B=sort(A);&lt;br&gt;
&amp;gt; B(1:10)=20;&lt;br&gt;
&amp;gt; B(90:100)=70;&lt;br&gt;
&amp;gt; Now I want to transform B-&amp;gt;A so that the indexing is same of what my A&lt;br&gt;
&amp;gt; was.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Since its an image I have to revert back to same indexing of vector&lt;br&gt;
&amp;gt; only with changed values that I did after sorting.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any idea ?&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Use the second output argument of 'sort':&lt;br&gt;
&lt;br&gt;
&amp;nbsp;[B,p] = sort(A);&lt;br&gt;
&amp;nbsp;B(1:10) = 20;&lt;br&gt;
&amp;nbsp;B(90:100) = 70;&lt;br&gt;
&amp;nbsp;A(p) = B;&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Thu, 13 Nov 2008 13:15:03 -0500</pubDate>
      <title>Re: Sort and revert</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159#610685</link>
      <author>Roger Stafford</author>
      <description>&quot;Roger Stafford&quot; &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt; wrote in message &amp;lt;gfgjl1$r0c$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; fas &amp;lt;faisalmufti@gmail.com&amp;gt; wrote in message &amp;lt;195e56e8-c7b9-49b3-839f-fd0468067e86@35g2000pry.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; I have a vector which I have sorted B=sort(A); Now after changing the&lt;br&gt;
&amp;gt; &amp;gt; 10 values on either end I would like to take the vector back to A.&lt;br&gt;
&amp;gt; &amp;gt; B=sort(A);&lt;br&gt;
&amp;gt; &amp;gt; B(1:10)=20;&lt;br&gt;
&amp;gt; &amp;gt; B(90:100)=70;&lt;br&gt;
&amp;gt; &amp;gt; Now I want to transform B-&amp;gt;A so that the indexing is same of what my A&lt;br&gt;
&amp;gt; &amp;gt; was.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Since its an image I have to revert back to same indexing of vector&lt;br&gt;
&amp;gt; &amp;gt; only with changed values that I did after sorting.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Any idea ?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Use the second output argument of 'sort':&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  [B,p] = sort(A);&lt;br&gt;
&amp;gt;  B(1:10) = 20;&lt;br&gt;
&amp;gt;  B(90:100) = 70;&lt;br&gt;
&amp;gt;  A(p) = B;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Or you could do this instead:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;[p,p] = sort(A);&lt;br&gt;
&amp;nbsp;A(p(1:10)) = 20;&lt;br&gt;
&amp;nbsp;A(p(90:100)) = 70;&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Sun, 16 Nov 2008 01:39:24 -0500</pubDate>
      <title>Re: Sort and revert</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/239159#611109</link>
      <author>fas</author>
      <description>On Nov 14, 12:15=A0am, &quot;Roger Stafford&quot;&lt;br&gt;
&amp;lt;ellieandrogerxy...@mindspring.com.invalid&amp;gt; wrote:&lt;br&gt;
&amp;gt; &quot;Roger Stafford&quot; &amp;lt;ellieandrogerxy...@mindspring.com.invalid&amp;gt; wrote in mes=&lt;br&gt;
sage &amp;lt;gfgjl1$r0...@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; fas &amp;lt;faisalmu...@gmail.com&amp;gt; wrote in message &amp;lt;195e56e8-c7b9-49b3-839f-f=&lt;br&gt;
d0468067...@35g2000pry.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have a vector which I have sorted B=3Dsort(A); Now after changing t=&lt;br&gt;
he&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 10 values on either end I would like to take the vector back to A.&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; B=3Dsort(A);&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; B(1:10)=3D20;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; B(90:100)=3D70;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Now I want to transform B-&amp;gt;A so that the indexing is same of what my =&lt;br&gt;
A&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; was.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Since its an image I have to revert back to same indexing of vector&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; only with changed values that I did after sorting.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Any idea ?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; =A0 Use the second output argument of 'sort':&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; =A0[B,p] =3D sort(A);&lt;br&gt;
&amp;gt; &amp;gt; =A0B(1:10) =3D 20;&lt;br&gt;
&amp;gt; &amp;gt; =A0B(90:100) =3D 70;&lt;br&gt;
&amp;gt; &amp;gt; =A0A(p) =3D B;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Roger Stafford&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 Or you could do this instead:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0[p,p] =3D sort(A);&lt;br&gt;
&amp;gt; =A0A(p(1:10)) =3D 20;&lt;br&gt;
&amp;gt; =A0A(p(90:100)) =3D 70;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&lt;br&gt;
Thanks a lot Roger!</description>
    </item>
  </channel>
</rss>

