Page 1 of 1

pass &gkbar_hh to a func

Posted: Thu Nov 04, 2010 10:52 pm
by pfortier
If I define param=4 then I can pass it's address to a function test(&param) but it fails when I try to pass &gkbar_hh as in test(&gkbar_hh) and test(&soma.gkbar_hh). Is there a way to pass the address of a RANGE variable?

Re: pass &gkbar_hh to a func

Posted: Fri Nov 05, 2010 11:23 am
by ted
To pass a range variable by reference, the location to which it refers must be specified unambiguously.
will fail for at least one reason: it doesn't specify a location in the range [0,1]. If there is no currently accessed section, it will also fail for a second reason (i.e. hoc can't guess which section you mean).

These examples will work:
dend test(&gkbar_hh(0.5))
dend test(&gkbar_hh(z)) // assuming that 0 <= z <= 1
dend {
. . . hoc statements . . .
. . . hoc statements . . .

If a default section has been specified with an access statement, e.g.
access soma
will work and the particular "gkbar_hh(0.5)" that proc test() receives will be the one that belongs to soma.