The backdrop: I’m starting to learn the language and am playing around with both JuliaBox and locally installed JuliaPro.
Here’s a silly way to create 3x3 array of three 0s, 1s and 2s arranged randomly:
myvec = shuffle([fill(0,3); fill(1,3); fill(2,3)])
mymat = myvec[1:3]
for i = 2:3
mymat = hcat(mymat, myvec[fill(3*(i-1),3)+(1:3)])
This code snippet works without complaint on JuliaBox running Julia 1.0.3 and fails on JuliaPro running 1.0.2. The error is:
UndefVarError: mymat not defined
in top-level scope at base/none
in top-level scope at untitled:5
So it seems that the definition of mymat at line 3 is not available within the for loop in my JuliaPro but is available within the loop when using JuliaBox.
Can someone enlighten me as to what’s going on?
Thanks - and please tell me if this is the wrong place for very basic questions like this.