Hi,
I am having an issue with the v_init updating between my hoc code and the run control. In my hoc code, I set v_init=-70 as a global parameter, and then in my initialization section I set my e_pas=v_init. Everything seems to run fine, but when I change the v_init value in the run control (say to -10), although there are changes with the plot reflecting some of these changes, the e_pas is still at -70. Does anyone know why it would initialize correctly in some areas of the code but not throughout?
Thanks for your help!
Margo
v_init updating between the gui runcontrol and hoc code
-
- Site Admin
- Posts: 6299
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: v_init updating between the gui runcontrol and hoc code
So tell me if I understand correctly.
e_pas=v_init
has been executed, right?
e_pas = v_init
causes evaluation of the expression on the right hand side of the = sign, and assigns the numerical outcome of that evaluation to the variable on the left hand side of the = sign. In other words, e_pas is not a pointer or an object reference. The assignment statement does not forge a permanent link between e_pas and the stuff on the right hand side. e_pas gets what it gets at the time that the statement is executed.
If you want updates to v_init to also affect e_pas, you need to execute
e_pas = v_init
before you launch a simulation. You could do this with a custom proc init().
by which you mean that e_pas is -70, right?margopolo wrote:In my hoc code, I set v_init=-70 as a global parameter, and then in my initialization section I set my e_pas=v_init. Everything seems to run fine
And when are you making this change? _After_ the statementwhen I change the v_init value in the run control (say to -10)
e_pas=v_init
has been executed, right?
as it should be, because execution of the statementbut . . . e_pas is still at -70.
e_pas = v_init
causes evaluation of the expression on the right hand side of the = sign, and assigns the numerical outcome of that evaluation to the variable on the left hand side of the = sign. In other words, e_pas is not a pointer or an object reference. The assignment statement does not forge a permanent link between e_pas and the stuff on the right hand side. e_pas gets what it gets at the time that the statement is executed.
If you want updates to v_init to also affect e_pas, you need to execute
e_pas = v_init
before you launch a simulation. You could do this with a custom proc init().
Code: Select all
proc init() {
e_pas = v_init
finitialize(v_init)
if (cvode.active()) {
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}