Hi Folks:
Newbie here...
I often need to write code that iteratively reads files which are saved from a
long MCMC chain. Coming from Matlab I always try the following
a = []
b = []
k = 1
while isfile("data$k.csv")
data = readcsv("data$k.csv")
a = [a data[:,1]]
b = [b data[:,2]]
k += 100 # thin the chain by 100
end
This doesn't seem to work in julia. Does anyone have any recommendations on how
to accomplish this in a nice julian way? Here is one example:
a = Array(Float64,512,0)
b = Array(Float64,512,0)
k = 1
while isfile("data$k.csv")
data = readcsv("data$k.csv")
a = [a data[:,1]]
b = [b data[:,2]]
k += 100
end
I would like to avoid this since it requires me to know I have 512 rows ahead
of time. Of course, I could always do this
data = readcsv("data1.csv")
a = data[:,1]
b = data[:,2]
k = 101
while isfile("data$k.csv")
data = readcsv("data$k.csv")
a = [a data[:,1]]
b = [b data[:,2]]
k += 100
end
...but its not as clean.