(42S) Matrix Sort
|
07-05-2018, 06:08 PM
(This post was last modified: 07-05-2018 09:32 PM by Dave Britten.)
Post: #1
|
|||
|
|||
(42S) Matrix Sort
A simple program for sorting a matrix by your choice of column, in either ascending or descending order.
Usage Arguments: y: Matrix x: Column number (1-based) Flag 1: Clear = Ascending Order, Set = Descending Order Put the arguments on the stack and XEQ "SORT". The sorted matrix will be left on the stack in x. Attempting to sort a 1-row matrix will exit cleanly without doing anything. EDIT: A nicer version that uses the built-in (hidden) "[MIN]" and "[MAX]" functions to do selection sort. When keying this in, note that the brackets are part of the function name and must be included! I've written that function as XEQ "[MIN]" for clarity, but you'll only see [MIN] after entering the command. Thanks Joe. Code: LBL "SORT" |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(42S) Matrix Sort - Dave Britten - 07-05-2018 06:08 PM
RE: (42S) Matrix Sort - Joe Horn - 07-05-2018, 08:16 PM
RE: (42S) Matrix Sort - Dave Britten - 07-05-2018, 08:28 PM
RE: (42S) Matrix Sort - Joe Horn - 07-05-2018, 09:17 PM
RE: (42S) Matrix Sort - Dave Britten - 07-05-2018, 09:27 PM
RE: (42S) Matrix Sort - Joe Horn - 07-05-2018, 10:21 PM
|
User(s) browsing this thread: 1 Guest(s)