create object in function

The basics of how to develop, test, and use models.
Post Reply
Tsirogiannis
Posts: 9
Joined: Mon May 29, 2006 12:33 pm
Location: National Technical University of Athens

create object in function

Post 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
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post 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
Post Reply