Skip to main content
21-Topaz II
October 8, 2024
Solved

Multiple column sorting

  • October 8, 2024
  • 2 replies
  • 1576 views

Hi,

It is easy using the csort(M,n) command but it only operates on one column.

Is there an easy way to sort on first two columns.

Also need to add if first two columns are identical ?

Capture.JPG

Thanks

Best answer by StuartBruff

I think there have been a couple of threads on this issue.  Tom Gutman, one of the old cadre, wrote one using rank sort.  Here's a thread in which @RichardJ  and @LucMeekes give solutions (Richard's was an improvement on Tom's, and Luc's is different - AFAICT, just scanning the message.  I haven't looked at the worksheets, but if they're by Tom, Richard, and Luc, the routines should be more than good enough for most purposes (Luc's handles larger matrices more reliably)

 

https://community.ptc.com/t5/Mathcad/Csort-is-it-true/m-p/706968/highlight/true#M193865 

 

By an interesting coincidence, I'm in the process of updating an old complex-number mergesort worksheet of mine to MP10.  I'm also fiddling around with it to see if I can get it to sort on functions ... no idea what the sorting criterion should be.

 

Stuart

2 replies

23-Emerald V
October 8, 2024

I think there have been a couple of threads on this issue.  Tom Gutman, one of the old cadre, wrote one using rank sort.  Here's a thread in which @RichardJ  and @LucMeekes give solutions (Richard's was an improvement on Tom's, and Luc's is different - AFAICT, just scanning the message.  I haven't looked at the worksheets, but if they're by Tom, Richard, and Luc, the routines should be more than good enough for most purposes (Luc's handles larger matrices more reliably)

 

https://community.ptc.com/t5/Mathcad/Csort-is-it-true/m-p/706968/highlight/true#M193865 

 

By an interesting coincidence, I'm in the process of updating an old complex-number mergesort worksheet of mine to MP10.  I'm also fiddling around with it to see if I can get it to sort on functions ... no idea what the sorting criterion should be.

 

Stuart

ttokoro
21-Topaz I
21-Topaz I
October 10, 2024
21-Topaz II
October 10, 2024

Thank you @ttokoro this is excellent.

Cheers

Terry

ttokoro
21-Topaz I
21-Topaz I
October 10, 2024

x=0 and/or y=0 can treat. Bug fixed. Now P with 10,000 rows can treat by IJS(P) function.

image.png

image.png

t.t.