Programmer Guide/Command Reference/EVAL/sort: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====sort=====
Sort the vector or matrix ''x''.


Sort the the rows or the columns of the vector <var>x</var>. This is a subcommand of the <code>[[Programmer Guide/Command Reference/EVAL/EVAL|EVAL]]</code> command.
----
 
;Usage: <code>'''sort(''type'', ''x'' {, ''i'' })
{|
;''mode'': specifies the sort direction and the row or column containing the data to be sorted
;''x'': vector or matrix to be sorted
;''i'': row or column containing the sort data; depends ion ''type'' (default=0)
;Result: The sorted vector or matrix ''x''.
:{|class=einrahmen
!''type'' | ''i'' | description
|-
|-
|Usage:
|'''0'''| column index | sort rows of ''x'' ascending by the values of column  ''i''
|sort( dir{0|1}, <var>x</var>, [<var>col</var>=0])
|-
|-
|  
|'''1'''| column index | sort rows of ''x'' descending by the values of column  ''i''
|sort( dir{2|3}, <var>x</var>, [<var>row</var>=0])
|-
|-
|Parameters:
|'''2'''| row index | sort columns of ''x'' acending by the values of row  ''i''
|{|
|-
|-
|<var>dir</var>
|'''3'''| row index | sort columns of ''x'' descending by the values of row ''i''
|The direction to sort in (0=sort the rows in ascending order, 1=sort the rows in descending order, 2=sort the columns in ascending order, 3=sort the columns in descending order).
 
|-
|x
|The vector to sort.
|-
|col
|The column to use for sorting.
|-
|row
|The row to use for sorting.
|}


;See also: [[Programmer_Guide/Command_Reference/EVAL/median|median]], [[Programmer_Guide/Command_Reference/EVAL/sample|sample]], [[Programmer_Guide/Command_Reference/EVAL/shuffle|shuffle]]


|  
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
|-
|Return Type:
|no result
|}

Revision as of 09:17, 11 April 2011

Sort the vector or matrix x.


Usage
sort(type, x {, i })
mode
specifies the sort direction and the row or column containing the data to be sorted
x
vector or matrix to be sorted
i
row or column containing the sort data; depends ion type (default=0)
Result
The sorted vector or matrix x.
i | description
column index | sort rows of x ascending by the values of column i
column index | sort rows of x descending by the values of column i
row index | sort columns of x acending by the values of row i
row index | sort columns of x descending by the values of row i


See also
median, sample, shuffle

<function list>

Navigation menu

Personal tools