Code: Select all
// Insert stimulation
objref stim[ncells]
for i=0, ncells-1 sIN[i].soma {
stim[i] = new IClamp(0.5)
}
DUR = 0.1 // ms, duration of each pulse
AMP = 0.1 // nA
START = 5 // ms, time of first pulse
INTERVAL = 25 // ms, interval between pulse starts
// assumes DUR < INTERVAL
objref fih
fih = new FInitializeHandler("initi()")
STIMON = 0
proc initi() {
STIMON = 0
stim[i].del = 0 // we want to exert control over amp starting at 0 ms
stim[i].dur = 1e9 // if we're going to change amp,
// dur must be long enough to span all our changes
cvode.event(START, "seti()")
}
proc seti() {
// print "time is ", t
if (STIMON==0) {
STIMON = 1
stim[i].amp = AMP
cvode.event(t + DUR, "seti()")
cvode.event(t + INTERVAL, "seti()")
} else {
STIMON = 0
stim[i].amp = 0
}
// we've changed a parameter abruptly
// so we really should re-initialize cvode
if (cvode.active()) {
cvode.re_init()
} else {
fcurrent()
}
}
strdef gtxt
for i=0,ncells-1 {
sprint(gtxt,"IN[%d].soma.v(0.5)",i)
addgraph(gtxt,-120,40)
}
access IN[0].soma //Set In as default cell
// Initiale stimulation
init()
run()
/usr/bin/nrniv: subscript out of range stim in FS-1elect.hoc near line 158
{initi()}
^
initi()
finitialize(-70)
init()
/usr/bin/nrniv: Segmentation violation See $NEURONHOME/lib/help/oc.help in FS-1e lect.hoc near line 158
Line 158 is the final line on this part of the code
Thanks
Here's the link to the code I have found on this forum https://www.neuron.yale.edu/phpBB2/view ... light=ramp