[julia-users] Re: Indexing problem

2016-11-17 Thread Patrik Waldmann
OK, that works fine. Thanks. I think it would be a good idea to drop the matlab-ism in future versions. Patrik On Thursday, November 17, 2016 at 11:51:09 AM UTC+1, Simon Byrne wrote: > I'm not familiar with the package in question, but this line: > > w = Any[ 0.1*randn(1,13), 0 ] > > may be wha

[julia-users] Re: Indexing problem

2016-11-17 Thread Simon Byrne
I'm not familiar with the package in question, but this line: w = Any[ 0.1*randn(1,13), 0 ] may be what is causing the problem. It is creating a 2-element Vector, the first element of which is a 1x13 Matrix, and the second element is a scalar 0. The analogous object in R would be: W = list(mat

[julia-users] Re: Indexing problem

2016-11-17 Thread Patrik Waldmann
I guess I should have explained my problem clearer. If I run the code without w[1,(w[1].-(z))] = 0, and do: dump(w) Array{Any}((2,)) 1: Array{Float64}((1,13)) [-0.681392 0.595298 … 0.893845 -3.5044] 2: Float64 22.447679788630705 and println(w[1]) [-0.681392 0.595298 -0.394906 0.776983 -1.1

[julia-users] Re: Indexing problem

2016-11-16 Thread Jeffrey Sarnoff
good things to know about how indexing works The indices for a Vector, or a column or row of a Matrix start at *1* ``` length(avector) # gets the number of elements in avector avector[1]# gets the first item in avector avector[end] # gets the final item in avector avector[1:end]