Hello,
i have this program
load_file("nrngui.hoc")
create soma[5]
objref listsoma
forall insert pas
listsoma = new SectionList()
forall {
listsoma.append()
}
access listsoma.object(0)
print secname()
The problem is access listsoma.object(0). In particular the error is the following
NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits
1
object not a public member of SectionList
c:\nrn\bin\nrniv.exe: SectionList object
in C:/Users/alessandra/Desktop/test-nc.hoc near line 13
access listsoma.object(0)
^
How can i solve the problem?
Than you
Alessandra
How to access the object of a list
-
- Site Admin
- Posts: 6303
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: How to access the object of a list
The SectionList class doesn't have an object method; if it did, the method would be documented in the Programmer's Reference entry about SectionList.
The most useful answer to your question depends on why you want to access a particular element in a SectionList.
The most useful answer to your question depends on why you want to access a particular element in a SectionList.
Re: How to access the object of a list
I'd like to build an array of sections that i can pass as an argument of a proc.
-
- Site Admin
- Posts: 6303
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: How to access the object of a list
Presumably you have a collection of sections that have some shared property. You could append them to a SectionList, then pass that SectionList as an argument. In the proc you can then iterate over all the sections like so:
FYI the CellBuilder's Subsets page actually creates SectionLists.
Code: Select all
// $o1 is a SectionList
proc foo() {
forsec $o1 {
. . . statements . . .
}
}