0
$\begingroup$

I have a table of large number of elements, each with three elements, say

A = {{a, b, c}, {e, f, g}...}.

I am using the function SortBy[A, First] to order the table acoording to the first element in increasing numerical value.

Function is working fine otherwise, but not if I put it under delayed o/p (:=) condition in the middle of a multi-step code. In this scenario, the table is sorted by first having 0s, then negative followed by positive first place elements, rather than first negative, followed by zeros and than positives.

Will appreciate any suggestion. Could there be better alternative to SortBy ?

thanks

$\endgroup$
  • $\begingroup$ Can you prepare a minimal example to reproduce your problem? $\endgroup$ – Kuba Apr 16 '18 at 9:09
  • $\begingroup$ Just to avoid confusion: SortBy[A, First] will return the result of sorting A. It will not, however, store the result back into A. In other words, SortBy[A, First] does not affect the value of A. I just wanted to point that out in case this was the source of confusion (it wouldn't be the first time). $\endgroup$ – Sjoerd Smit Apr 16 '18 at 9:18
  • $\begingroup$ Kuba..Thanks. Is there a way to share Mathematica file ?? $\endgroup$ – user49535 Apr 16 '18 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.