odd list behaviour
Posted: Fri Oct 26, 2007 11:27 am
Hi,
I have a strange problem with saving Vectors to Lists.
I have writtten a piece of hoc iterates through different positions on a detailed morphological model's dendrite to inject current pulses through an iClamp.
The idea is to run t he same cell with only one IClamp at a time recording the result into a vector and collecting vectors into a List, as done many times before.
The essential code looks like this:
This works fine, both the original vector and the retrived vector overlay in the plot. But now the funny bit starts, in a separate proc I want to save the results to a file and then the data in the retrieved vectors is different!
Although vector id's seem to be the same?!
The plot of V3 in the graph is completely different to the previous 2 plots.
But the object id's of the Vecors are the same (print V3)
The relevant toplevel bit looks like this:
So there isnt much happening in between. I can't figure out where the bug is. Any help is very much appreciated!
Thanks
ub
I have a strange problem with saving Vectors to Lists.
I have writtten a piece of hoc iterates through different positions on a detailed morphological model's dendrite to inject current pulses through an iClamp.
The idea is to run t he same cell with only one IClamp at a time recording the result into a vector and collecting vectors into a List, as done many times before.
The essential code looks like this:
Code: Select all
proc injectstimrun() {local i
forsec injsec{
p= secx.x[ind0]
secname() stim0=new IClamp(p)
stim0.del=0
stim0.dur=600
stim0.amp=0.005
V2=new Vector()
print V2
secname() V2.record(&v(p),T)
vlist2.append(V2)
// init & run & plot
init()
run()
V2.line(g2,T,1,2)
V3=vlist2.o(vlist2.count()-1)
V3.line(g2,T,2,0.1)
stim0=nil
}
print "\n \n"
}
Although vector id's seem to be the same?!
Code: Select all
proc save(){
vc=vlist2.count()
Res= new Matrix (n,vc+1)
Res.setcol(0,T)
for k=0, vc-1 {
Res.setcol(k+1,vlist2.object[k])
V3=vlist2.object[k]
print V3
V3.line(g2,T,3,0.5)}
fo=new File()
strdef fn
sprint(fn,"%spas_serial_0%d0%d.dat",pat,passflag,i)
fo.wopen(fn)
tmp=Res.fprint(0, fo, "%-f\t", "\n")
fo.close()
print " ", vc, "+1"
}
But the object id's of the Vecors are the same (print V3)
The relevant toplevel bit looks like this:
Code: Select all
...
print "\n > inject stimulus & init & run \n"
injectstimrun(0)
print "\n > save \n"
save()
...
So there isnt much happening in between. I can't figure out where the bug is. Any help is very much appreciated!
Thanks
ub