You explictly told Julia to sort columns with dims=1. Julia is column-major so the first dimension goes down the column. If you want to sort within the rows, use dims=2.

I think OP implicitly assumed a structure to his matrix where elements are grouped row-wise so sorting any column would mean all columns are sorted by the sorting order of that column (like when sorting a DataFrame by the values of a single column). E.g.

julia> x = [2 "b"; 1 "c"; 3 "a"]
3×2 Matrix{Any}:
2 "b"
1 "c"
3 "a"