In hoc a function returns a double precision value, not an array of double precision values. One can pass a double by reference, e.g.
Code: Select all
double bla[3]
for i=0,2 bla[i]=i
for i=0,2 print bla[i]
proc foo() { $&1[1]=PI }
foo(&bla)
for i=0,2 print bla[i]
but that's almost deprecated.
Much better is to use Vectors.
Code: Select all
objref cvec
cvec = new Vector(2)
proc setvec() { local i
for i=0, $o1.size()-1 $o1.x[i] = sqrt(1+i)
}
setvec(cvec)
cvec.printf()
It would be good to review the elements of hoc syntax, which are detailed in chapters 12 and 13 of The NEURON Book and documented at various places in the Programmer's Reference e.g.
http://www.neuron.yale.edu/neuron/stati ... tml#syntax
http://www.neuron.yale.edu/neuron/stati ... rogramming
http://www.neuron.yale.edu/neuron/stati ... n/obj.html