How to connect multiple compartments of an axon using a for loop?
Posted: Tue Jan 28, 2020 1:19 am
So I have an axon which has a 1000 compartments. I have written a for loop that connects the [1] part of one compartment to the [0] of the other and so on until all 1000 compartments are connected. However, I then get the following error: "axon_1[0] connection will form loop
in axon_diam_part2.hoc near line 23". Could anyone help me debug this part of my code? Would really appreciate!!
Code:
numParts =1000
create axon_1[numParts] //axon of 10 um diameter
access axon_1
for (i=0; i<numParts; i=i+1){
axon_1{
length=100
diam=10
Rm=40000 //ohm-cm^2
Ra=200 //ohm-cm
insert hh //Inserting Hodgkin Huxley
}
}
for (i=0; i<numParts; i=i+1){
connect axon_1[i-1](1), axon_1(0) // connects end of axon[0] to start of axon[1]
}
//Inserting stimulus for axon 1
objectvar mystim // This is a variable name
axon_1 mystim = new IClamp(0) // Inserting current stim at start of axon
mystim.del = 100 // ms, Delay until stim turns on
mystim.dur = 100 // ms, How long stim stays on
mystim.amp = 9 // nA, from inside to outside membrane
tstop = 300 // ms, defaults to 5
in axon_diam_part2.hoc near line 23". Could anyone help me debug this part of my code? Would really appreciate!!
Code:
numParts =1000
create axon_1[numParts] //axon of 10 um diameter
access axon_1
for (i=0; i<numParts; i=i+1){
axon_1{
length=100
diam=10
Rm=40000 //ohm-cm^2
Ra=200 //ohm-cm
insert hh //Inserting Hodgkin Huxley
}
}
for (i=0; i<numParts; i=i+1){
connect axon_1[i-1](1), axon_1(0) // connects end of axon[0] to start of axon[1]
}
//Inserting stimulus for axon 1
objectvar mystim // This is a variable name
axon_1 mystim = new IClamp(0) // Inserting current stim at start of axon
mystim.del = 100 // ms, Delay until stim turns on
mystim.dur = 100 // ms, How long stim stays on
mystim.amp = 9 // nA, from inside to outside membrane
tstop = 300 // ms, defaults to 5