vincet
vincet

Reputation: 977

Julia : index variable between brackets?

l have a vector of 1000 values l want to divide this 10000 values in different files

m=rand(1000)

vector[1]=m[1:150]
vector[2]=m[151:450]
vector[3]=m[450:800]
vector[4]= m=[801:1000]

it's not working l got this error

ERROR: UndefVarError: vector not defined

in eval(::Module, ::Any) at ./boot.jl:237

then l tried to set an empty vector

vector = Vector{Float64}

it remains not working

then l did a loop

for i in 1:4
vector[i]=Vector{Float64}
end

l got the same error

Upvotes: 0

Views: 105

Answers (1)

isebarn
isebarn

Reputation: 3940

Try

vector = Vector()    
push!(vector, m[1:150])
.
.
.
push!(vector, m[801:1000])

Upvotes: 1

Related Questions