I might be asking something that is obvious but my mind is stuck.
I found similar code in other forum questions that should be working as I was expecting it to work but I get results I don't expect.
Code: Select all
objref test1
objref test2
objref results_list
objref tmpvec
proc record_results() {
results_list = new List()
tmpvec = new Vector()
forall {
tmpvec.record(&v(0.5))
results_list.append(tmpvec)
}
test1 = new Vector()
test2 = new Vector()
test1.record(&cen_myelin[19].v(0.5))
test2.record(&cen_myelin[0].v(0.5))
}
record_results() // This saves the internal voltage of each segment in a list
The results_list I expected to have a list with all the time evolution of the sections in my model. Instead I do get a list that has the correct number of sections but it holds only the last section's recording.
more specifically, i have 55 sections and this list has 55 identical vectors and they all correspond to the last section.
Why is this? Instead of passing a value I pass a reference that gets updated every time resulting in the same ouput?