<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hello,<br>
<br>
Do you want to sort every column (in its own order)? If so I think you
should use gsort(D, 'c').<br>
<br>
If you just want to sort 1 column you could use gsort(D(:, j), 'c').<br>
<br>
Last but not least you can sort one column (as above) and use the
vector k (return by gsort) to permute the other columns (so each row is
preserved).<br>
<br>
HTH,<br>
Mathieu<br>
On 11/17/2010 02:40 PM, Carrico, Paul wrote:
<blockquote
cite="mid:55A12CBC06A8C9459DCE0BBEF8122FDC0498AF8E@exchsrv.AUXITROL1"
type="cite">
<div><font face="Arial" size="2"><span class="799083313-17112010">
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;" lang="EN-GB">Dear all,</span><span
style="" lang="EN-GB"></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span style=""
lang="EN-GB"><font size="3"><font face="Times New Roman"> </font></font></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;" lang="EN-GB">Sort
algorithms are rather new for me ...</span><span style="" lang="EN-GB"></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span style=""
lang="EN-GB"><font size="3"><font face="Times New Roman"> </font></font></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;" lang="EN-GB">In the
example herebellow and after some tests, I’ve noticed that the matrix
is sorted from the 1rst column :</span><span style="" lang="EN-GB"></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;" lang="EN-GB">- is it
possible to choose the column to sort ?</span><span style=""
lang="EN-GB"></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;" lang="EN-GB">- otherwise
does it mean it's necessary to permute the desired column with the
first one to sort ?</span><span style="" lang="EN-GB"></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span style=""
lang="EN-GB"><font size="3"><font face="Times New Roman"> </font></font></span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;">Thanks in advance</span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><font
face="Times New Roman"> </font></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;">Cheers</span></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><font size="3"><font
face="Times New Roman"> </font></font></p>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="font-family: Arial; font-size: 10pt;">Paul</span></p>
</span></font><font face="Arial" size="2"><span
class="799083313-17112010"></span></font></div>
<div><font face="Arial" size="2"><span class="799083313-17112010"></span></font> </div>
<div><span class="799083313-17112010"></span><font face="Arial"
size="2"><span class="799083313-17112010">########</span></font></div>
<div> </div>
<div><font face="Arial" size="2">mode(0); <br>
clearglobal();</font></div>
<div> </div>
<div><br>
<font face="Arial" size="2">D = [ </font></div>
<div><font face="Arial"><font size="2"><span
class="799083313-17112010"> </span>1 0 3 11 10 13;</font></font></div>
<div><font face="Arial"><font size="2"><span
class="799083313-17112010"> </span> 4 9 6 -1 -1 0; </font></font></div>
<div><font face="Arial"><font size="2"> 17 8 39 9 -451 3; </font></font></div>
<div><font face="Arial"><font size="2"> 10 110 -12 1 -9 45 ; </font></font></div>
<div><font face="Arial"><font size="2"> -13 514 15 78 -99 3]</font></font></div>
<div> </div>
<div><br>
<font face="Arial" size="2">D_lr = gsort(D,'lr','i')</font></div>
<pre>--------------------------------------------------------------------------------
Le présent mail et ses pièces jointes sont confidentiels et destinés à la personne ou aux personnes visée(s) ci-dessus. Si vous avez reçu cet e-mail par erreur, veuillez contacter immédiatement l'expéditeur et effacer le message de votre système. Toute divulgation, copie ou distribution de cet e-mail est strictement interdite.
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email.
</pre>
</blockquote>
</body>
</html>