In the first example, the SectionRef variable is declared both globally and in the localobj statement. When i run the function, changes in the variable "s" seem to appear only in the global version, as reported in the "psection" output after the oc> prompt.
In the second example (after the ~~~~'s) I omit the global declaration; now the function fails, behaving as if the objref was not declared.
I'm running MS windows XP pro.
Thanks for the help -- TedB
with objref declared in my global file and this for foobar1:
Code: Select all
proc foobar1(){ localobj s
strdef mystr, mysec
mysec=$s1
sprint(mystr, "access %s", mysec)
execute(mystr)
soma s = new SectionRef()
s.sec {psection()}
sprint(mystr, "%s s = new SectionRef()", mysec)
execute(mystr)
s.sec {psection()}
}
NEURON -- Release 7.0 (281:80827e3cd201) 2009-01-16
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html
1
1
1
1
oc>access soma
oc>psection()
soma { nseg=1 L=30 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=30}
insert capacitance { cm=1}
insert IClamp { del=1 dur=9 amp=10}
insert pas { g_pas=0.001 e_pas=-70}
}
1
oc>foobar1("dend")
soma { nseg=1 L=30 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=30}
insert capacitance { cm=1}
insert IClamp { del=1 dur=9 amp=10}
insert pas { g_pas=0.001 e_pas=-70}
}
soma { nseg=1 L=30 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=30}
insert capacitance { cm=1}
insert IClamp { del=1 dur=9 amp=10}
insert pas { g_pas=0.001 e_pas=-70}
}
oc> s.sec {psection()}
dend[0] { nseg=1 L=100 Ra=35.4
soma connect dend[0] (0), 1
/* First segment only */
insert morphology { diam=1}
insert capacitance { cm=1}
insert pas { g_pas=0.001 e_pas=-70}
}
oc>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If I omit the global declaration of
Code: Select all
objref s
oc>foobar1("dend")
soma { nseg=1 L=30 Ra=35.4
/*location 0 attached to cell 0*/
/* First segment only */
insert morphology { diam=30}
insert capacitance { cm=1}
insert IClamp { del=1 dur=9 amp=10}
insert pas { g_pas=0.001 e_pas=-70}
}
nrniv: syntax error
near line 18
{dend s = new SectionRef()}
^
execute("dend s = new SectionRef()" )
foobar1("dend" )
nrniv: execute error: dend s = new SectionRef()
near line 18
^