Testing if an Object ID exists

The basics of how to develop, test, and use models.
Post Reply
aluchko

Testing if an Object ID exists

Post by aluchko »

Is there a way to get a list of Objects of a certain type?

Say I create a Foo object, that becomes Foo[0], I create a second, and third, Foo[1] and Foo[2], then delete the second so I now have Foo[0] and Foo[2].

Is there a way to discover the existence of Foo[0] and Foo[2]?

The closest I can see is the SymChooser, but that's a GUI tool and doesn't seem to do what I need.
ted
Site Admin
Posts: 5795
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Testing if an Object ID exists

Post by ted »

Read about allobjects() in the Programmer's Reference.
aluchko

Re: Testing if an Object ID exists

Post by aluchko »

Thanks that does the trick.


One more question though, is hoc_stdio the only way to capture the output of the function?

http://www.neuron.yale.edu/neuron/stati ... #hoc_stdio

It does the job but I wouldn't mind something a bit cleaner than writing temporary files.
hines
Site Admin
Posts: 1603
Joined: Wed May 18, 2005 3:32 pm

Re: Testing if an Object ID exists

Post by hines »

Since you know the type you can say
objref xxx
xxx = new List("type")
for i=0, xxx.count-1 print xxx.o(i)
Post Reply