Page 1 of 1

create object in function

Posted: Tue Oct 03, 2006 9:26 am
by Tsirogiannis
A rather simple question, but I can't find anything to make amends of the error in:

newSynapse=new Exp2Syn(0)

in the following function definition.

Code: Select all

func makeSynapse() { local newSynapse
    newSynapse=new Exp2Syn(0)
    newSynapse.tau1=0.05
    newSynapse.tau2=0.1
    newSynapse.e=-30
    return newSynapse
}
How should I create a new local object in this function?

And another question...

Is it possible to pass as an argument to a function or procedure a 2-D array? I have experimented but it seems that it needs something special, if it can be done.

Thanks in advance

Posted: Tue Oct 03, 2006 9:58 am
by ted
The keyword to use for this is "localobj", rather than "local". It is documented in the
Programmer's Reference--look in the alphabetical index (simply called "index" on this
page http://www.neuron.yale.edu/neuron/stati ... tents.html), right below the keyword
"local". An example of usage based on your particular instance is

Code: Select all

func makeSynapse() { localobj newSynapse