I'm using NEURON for my thesis for graduate paper.
What i am doing now is that print out coordinate info of each segment into txt.file with using interpxyz.hoc in extracellular_stim_and_rec.zip
But the problem is "subscript out of range error".
This is a part of my code
Code: Select all
proc grindaway() { local ii, nn, kk, xr
forall {
// get the data for the section
nn = n3d()
//print nn
//print secname()
xx = new Vector(nn)
yy = new Vector(nn)
zz = new Vector(nn)
length = new Vector(nn)
for ii = 0,nn-1 {
xx.x[ii] = x3d(ii)
yy.x[ii] = y3d(ii)
zz.x[ii] = z3d(ii)
length.x[ii] = arc3d(ii)
}
// to use Vector class's .interpolate()
// must first scale the independent variable
// i.e. normalize length along centroid
length.div(length.x[nn-1])
// initialize the destination "independent" vector
range = new Vector(nseg+2)
range.indgen(1/nseg)
range.sub(1/(2*nseg))
range.x[0]=0
range.x[nseg+1]=1
// length contains the normalized distances of the pt3d points
// along the centroid of the section. These are spaced at
// irregular intervals.
// range contains the normalized distances of the nodes along the
// centroid of the section. These are spaced at regular intervals.
// Ready to interpolate.
xint = new Vector(nseg+2)
yint = new Vector(nseg+2)
zint = new Vector(nseg+2)
xint.interpolate(range, length, xx)
yint.interpolate(range, length, yy)
zint.interpolate(range, length, zz)
//print secname()
//print nseg
center_pt = new Vector(3)
//f.wopen("coordinate.txt")
//print range.size
//print xint.size
for ii = 1, nseg {
xr = range.x[ii]
center_pt.x[0] = xint.x[ii]
center_pt.x[1] = yint.x[ii]
center_pt.x[2] = zint.x[ii]
//print center_pt
//f.printf("%f %f %f \n",center_pt.x[0], center_pt.x[1], center_pt.x[2])
}
//f.close()
}
}
Code: Select all
for ii = 1, nseg {
xr = range.x[ii]
center_pt.x[0] = xint.x[ii]
center_pt.x[1] = yint.x[ii]
center_pt.x[2] = zint.x[ii]
//print center_pt
//f.printf("%f %f %f \n",center_pt.x[0], center_pt.x[1], center_pt.x[2])
}
C:\nrn73w64\bin64\nrniv.exe: subscript out of range x
..(omit).... near line 445
grindaway()
^
grindaway()
nrn_define_shape: soma first and last 3-d point at same (x,y)
How can I debug the error?