query export data into matrix
Posted: Sun Jan 18, 2009 12:12 pm
Dear Ted,
I have started using this program very recently, and I would like to ask you about a particular piece of code doesnt work.
I have been implementing McIntyre's axon (from the model DB) and I have created a program to store the potential values of each node (the axon has 21 nodes) in a matrix, to export it to a data file and process it in matlab. However, when I write this in a loop, it does not work, and I do not want to run the program 21 times, because that is computationally inefficient. I am therefore copying 2 pieces of code.
1. This one does not work.
objref recv,m,savdata
recv= new Vector()
m= new Matrix()
savdata= new File()
for i=0,20{
recv.record(&Mcaxons.node.v(0.5))
m.resize((recv.size()+1),20)
m.setcol(i,recv)
}
tstop=105
run()
savdata.wopen("matrixv1.dat")
m.fprint(savdata, "%g")
savdata.close()
2. If I put the run() command before recv.record(...) it does not record anything. Why does this happen?
3. If I dont loop things my program works, why is this?
objref recv,recv1,recv2,m,savdata
recv=new Vector()
recv1=new Vector()
recv2= new Vector()
m= new Matrix()
savdata= new File()
recv.record(&Mcaxons.node[0].v(0.5))
recv1.record(&Mcaxons.node[1].v(0.5))
recv2.record(&Mcaxons.node[2].v(0.5))
tstop=105
run()
m.resize((recv.size()+1),3)
m.setcol(0,recv)
m.setcol(1,recv1)
m.setcol(2,recv2)
savdata.wopen("matrixv.dat")
m.fprint(savdata, "%g")
savdata.close()
Could you kindly suggest a better way of coding this? Thank you.
I have started using this program very recently, and I would like to ask you about a particular piece of code doesnt work.
I have been implementing McIntyre's axon (from the model DB) and I have created a program to store the potential values of each node (the axon has 21 nodes) in a matrix, to export it to a data file and process it in matlab. However, when I write this in a loop, it does not work, and I do not want to run the program 21 times, because that is computationally inefficient. I am therefore copying 2 pieces of code.
1. This one does not work.
objref recv,m,savdata
recv= new Vector()
m= new Matrix()
savdata= new File()
for i=0,20{
recv.record(&Mcaxons.node.v(0.5))
m.resize((recv.size()+1),20)
m.setcol(i,recv)
}
tstop=105
run()
savdata.wopen("matrixv1.dat")
m.fprint(savdata, "%g")
savdata.close()
2. If I put the run() command before recv.record(...) it does not record anything. Why does this happen?
3. If I dont loop things my program works, why is this?
objref recv,recv1,recv2,m,savdata
recv=new Vector()
recv1=new Vector()
recv2= new Vector()
m= new Matrix()
savdata= new File()
recv.record(&Mcaxons.node[0].v(0.5))
recv1.record(&Mcaxons.node[1].v(0.5))
recv2.record(&Mcaxons.node[2].v(0.5))
tstop=105
run()
m.resize((recv.size()+1),3)
m.setcol(0,recv)
m.setcol(1,recv1)
m.setcol(2,recv2)
savdata.wopen("matrixv.dat")
m.fprint(savdata, "%g")
savdata.close()
Could you kindly suggest a better way of coding this? Thank you.