(42S) Matrix Sort

07052018, 06:08 PM
(This post was last modified: 07052018 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 (1based) 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 1row matrix will exit cleanly without doing anything. EDIT: A nicer version that uses the builtin (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  07052018 06:08 PM
RE: (42S) Matrix Sort  Joe Horn  07052018, 08:16 PM
RE: (42S) Matrix Sort  Dave Britten  07052018, 08:28 PM
RE: (42S) Matrix Sort  Joe Horn  07052018, 09:17 PM
RE: (42S) Matrix Sort  Dave Britten  07052018, 09:27 PM
RE: (42S) Matrix Sort  Joe Horn  07052018, 10:21 PM

User(s) browsing this thread: 1 Guest(s)