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

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
Sort the vector or matrix ''x''.
Sort the vector or matrix ''x''.
 
;Usage: <code>'''sort(''mode'', ''x'' {, ''i'' })
----
;''mode'': specifies the sort direction and selects if ''x'' is sorted by the values of a row or column
;Usage: <code>'''sort(''type'', ''x'' {, ''i'' })
;''x'': vector or matrix to be sorted; must be a matrix if ''mode''>1
;''mode'': specifies the sort direction and the row or column containing the data to be sorted
;''i'': row or column containing the sort data; depends on ''mode'' (default=0)
;''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''.
;Result: The sorted vector or matrix ''x''.
:{|class=einrahmen
:{|class=einrahmen
!''type'' | ''i'' | description
!''mode'' !! ''i'' !! description
|-
|-
|'''0'''| column index | sort rows of ''x'' ascending by the values of column ''i''
|'''0'''|| column index || sort rows of ''x'' ascending by the values of column ''i''
|-
|-
|'''1'''| column index | sort rows of ''x'' descending by the values of column ''i''
|'''1'''|| column index || sort rows of ''x'' descending by the values of column ''i''
|-
|-
|'''2'''| row index | sort columns of ''x'' acending by the values of row ''i''
|'''2'''|| row index || sort columns of ''x'' ascending by the values of row ''i''
|-
|-
|'''3'''| row index | sort columns of ''x'' descending by the values of row ''i''
|'''3'''|| row index || sort columns of ''x'' descending by the values of row ''i''
|}
|}
;See also: [[../median|median]], [[../sample|sample]], [[../shuffle|shuffle]]


;See also: [[Programmer_Guide/Command_Reference/EVAL/median|median]], [[Programmer_Guide/Command_Reference/EVAL/sample|sample]], [[Programmer_Guide/Command_Reference/EVAL/shuffle|shuffle]]
[[../#Functions|<function list>]]
 
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]

Latest revision as of 11:57, 21 April 2011

Sort the vector or matrix x.

Usage
sort(mode, x {, i })
mode
specifies the sort direction and selects if x is sorted by the values of a row or column
x
vector or matrix to be sorted; must be a matrix if mode>1
i
row or column containing the sort data; depends on mode (default=0)
Result
The sorted vector or matrix x.
mode i description
0 column index sort rows of x ascending by the values of column i
1 column index sort rows of x descending by the values of column i
2 row index sort columns of x ascending by the values of row i
3 row index sort columns of x descending by the values of row i
See also
median, sample, shuffle

<function list>

Navigation menu

Personal tools