menica wrote:I don't have any error message.
The code you provided, reformatted slightly to improve readability, taking into account the correction you provided, and leaving out any statements that are not immediately related to creating new synaptic mechanisms, is
Code: Select all
nmaxsynE=3
ndend=3
objref ncl, ntc, synE[nmaxE]
ncl=new List()
for k=0,ndend{
for i=0, nmaxE {
L5PC.dend[k] synE[i] = new Exp2Syn(0.5)
. . . statements that assign synaptic parameters and set up a NetCon . . .
}
}
The third line
objref ncl, ntc, synE[nmaxE]
should produce the following error message:
undefined variable nmaxE
If you're not getting that error message, it's because you aren't showing me the actual code you're using. That is the second time for such a problem in this particular discussion thread. This is not a useful way to proceed. You really need to be getting advice from somebody who can sit down with you and review your code with you. Your ACTUAL code that you are ACTUALLY using. That would be somebody at your own institution, not me.
The problem is that with my code I am able to insert 3 synapses at the same dend[2], but I would like insert in each of the dend[0], dend[1], dend[2] one synapse.
As I just pointed out, this should not happen because there is a mistake that will stop program execution 4 lines before the statement that creates synaptic mechanisms.
But let's suppose that the code you provided is not the actual code that you're using, and that the code that you're using actually manages to execute these nested "for loops"
Code: Select all
for k=0,ndend{
for i=0, nmaxE {
L5PC.dend[k] synE[i] = new Exp2Syn(0.5)
. . . statements that assign synaptic parameters and set up a NetCon . . .
}
}
and let's also suppose that the nested "for loops" you are using are exactly like what you posted into this thread.
The outer loop will be executed four times--once for k=0,1,2, and 3. The inner loop will be executed nmaxE+1 times, assuming that nmaxE has nonnegative value. In the first pass through the outer loop, nmaxE+1 new ExpSyns will be created and attached to dend[0]. In the second pass through the outer loop, each of those ExpSyns will be discarded and nmaxE+1 new ExpSyns will be attached to dend[1] (who knows how many that is? presumably you, because only you have the actual code you're using). And after the last pass through the outer loop, the only section that has any ExpSyns will be dend[3]. To understand why, you need to read about Object Oriented Programming
http://www.neuron.yale.edu/neuron/stati ... n/obj.html
and documentation about the keywords
new
https://www.neuron.yale.edu/neuron/stat ... 0count#new
and
objref
https://www.neuron.yale.edu/neuron/stat ... unt#objref
in the Programmer's Reference.
If you only want to attach one ExpSyn to each of 3 sections called dend, there's no need to use a pair of nested loops. Use one loop that iterates over dend[0]..[2] and attaches one ExpSyn to each of them.
And find someone else to help you with your future questions, who can examine the ACTUAL code that you are ACTUALLY using.