Given
t7 = t8 = {{3, 5, 1}, {19, 2, 9}, {4, 3, 1}, {19, 0, 8}};
I want to Sort
the first two numbers in each sublist and keep the third number in its position. I can do it by
t7[[All, {1, 2}]] = Sort /@ t7[[All, {1, 2}]]
t7
or
t8[[All, {1, 2}]] = # & /@ #[[Ordering[#]]] & /@ t8[[All, 1 ;; 2]]
t8
to get
{{3, 5, 1}, {2, 19, 9}, {3, 4, 1}, {0, 19, 8}}
But there must be more elegant ways to do it. Any idea?