Thanks Mauro

That clears things up.

On Sunday, 30 November 2014 11:27:26 UTC+2, Mauro wrote:
>
> sortcols takes the whole colums and reorders them lexicographically 
> (whereas sort(A,2) sorts each row separately).  Thus sortcols will 
> mostly sort according to the first row and only if entries are equal 
> there will it take the next row into account. 
>
> On Sun, 2014-11-30 at 08:49, Adriaan van Niekerk <[email protected] 
> <javascript:>> wrote: 
> > Hi 
> > 
> > When I apply sortcols to a matrix (A) it only sorts the first row. When 
> I 
> > use sort(A,2) it works fine. 
> >   
> > Below is the printout from IJulia and the same thing happens when I run 
> > Julia in the terminal: 
> > 
> > In  [51]: A = rand(3,3) 
> > 
> > Out [51]: 3x3 Array{Float64,2}: 
> >  0.305663  0.810061  0.32777 
> >  0.697199  0.592799  0.977908 
> >  0.492569  0.486371  0.7781   
> > 
> > In  [52]: sort(A,2) 
> > 
> > Out [52]: 3x3 Array{Float64,2}: 
> >  0.305663  0.32777   0.810061 
> >  0.592799  0.697199  0.977908 
> >  0.486371  0.492569  0.7781   
> > 
> > In  [53]: sortcols(A) 
> > 
> > Out [53]: 3x3 Array{Float64,2}: 
> >  0.305663  0.32777   0.810061 
> >  0.697199  0.977908  0.592799 
> >  0.492569  0.7781    0.486371 
> > 
> > Is there something else I should know about sortcols? 
> > 
> > Thanks 
>
>

Reply via email to