Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Find index of maximum value of array

$
0
0

I have an array and I woul dlike to find the index of the maximum value. I tried with:


julia> X = [0,0,0,0,0,0,0,0,5,0,0,0,0,1]
14-element Array{Int64,1}:
 0
 0
 0
 0
 0
 0
 0
 0
 5
 0
 0
 0
 0
 1

julia> find(x == maximum(x), X)
ERROR: UndefVarError: x not defined
Stacktrace:
 [1] top-level scope at none:0

What would be the correct syntax? Thank you

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles