Hi Experts,
Assume there is an m by n all-digit matrix:
I need help to write a method that somewhat like 'order by' in ansi sql. This method shall be able to sort the matrix by ANY number of column indices passed in at cmdline.
For example, if cmdline is:
% myOrderby -col 1,2,5
It'll sort the matrix by column 1, 2, & 5.
However, if cmdline is
% myOrderby -col 1,4,8,11
It'll sort the matrix by column 1, 4, 8, & 11.
I know how to implement the method if there was a fixed maxium number of columns to "order by". I am looking for a method that can sort a matrix based on any number of columns that are ordered by.
Thanks for help.
Assume there is an m by n all-digit matrix:
Code:
X11 X12 ... X1n
X21 X22 ... X2n
...
Xmn Xmn ... Xmn
For example, if cmdline is:
% myOrderby -col 1,2,5
It'll sort the matrix by column 1, 2, & 5.
However, if cmdline is
% myOrderby -col 1,4,8,11
It'll sort the matrix by column 1, 4, 8, & 11.
I know how to implement the method if there was a fixed maxium number of columns to "order by". I am looking for a method that can sort a matrix based on any number of columns that are ordered by.
Thanks for help.