Can't use sort help, Here is code

 a = [7 0 4 6 2 3 9]
1×7 Array{Int64,2}:
 7  0  4  6  2  3  9

julia> sort(a)
ERROR: UndefKeywordError: keyword argument dims not assigned
Stacktrace:
 [1] sort(::Array{Int64,2}) at .\sort.jl:1045
 [2] top-level scope at REPL[2]:1

julia> sort!(a)
ERROR: UndefKeywordError: keyword argument dims not assigned
Stacktrace:
 [1] sort!(::Array{Int64,2}) at .\sort.jl:1105
 [2] top-level scope at REPL[3]:1

julia> sort!(a,dims = 1)
1×7 Array{Int64,2}:
 7  0  4  6  2  3  9

Are you looking for

julia> a = [7 0 4 6 2 3 9]
1×7 Matrix{Int64}:
 7  0  4  6  2  3  9

julia> sort!(a, dims = 2)
1×7 Matrix{Int64}:
 0  2  3  4  6  7  9

Your array is 1x7 as you see, so the dimension you want to sort along is the second.

3 Likes

Hi – you should use commas

julia>  b = [7, 0, 4, 6, 2, 3, 9]
julia> sort(b)

In Julia, the usual vector is a column vector, and row vectors (what you get when there is a space between numbers rather than a comma) are as @nilshg said.

3 Likes