Page 1 of 1

how to check where the error is

Posted: Thu Oct 07, 2010 6:07 am
by melissamou
Hi Ted,
I have create a axon according to the cable.hoc in the example "http://senselab.med.yale.edu/modeldb/Sh ... \cable.hoc" and my main code is

Code: Select all

objref f, x_model, y_model, z_model
objref neurite
objref tvec,pvec,veclist


load_file("nrngui.hoc")
xopen("D:/home/Model2/my model/SetPara.hoc")
xopen("D:/home/Model2/my model/axon.hoc")
proc GetSL(){
      neurite=new SectionList()
      forall{
          neurite.append()
      }
        proc InitCell() {
            // Extracellular, all parameters are default values
   forall insert extracellular
}

proc FindLoca() { local i,n      localobj x_comp,y_comp,z_comp
   localobj x_sect,y_sect,z_sect,len_sect,range

   x_model = new Vector()
   y_model = new Vector()
   z_model = new Vector()      
   forsec neurite {
      n = n3d()   
      x_sect = new Vector(n)
      y_sect = new Vector(n)
      z_sect = new Vector(n)
      len_sect = new Vector(n)
      
      for i = 0,n-1 {
         x_sect.x[i] = x3d(i)
         y_sect.x[i] = y3d(i)
         z_sect.x[i] = z3d(i)
         len_sect.x[i] = arc3d(i)   
      }
      len_sect.div(len_sect.x[n-1])         
      range = new Vector(nseg+2)
      range.indgen(1/nseg)  
      range.sub(1/(2*nseg))
      range.x[0] = 0
      range.x[nseg+1] = 1
      
      x_comp = new Vector(nseg+2)
      y_comp = new Vector(nseg+2)
      z_comp = new Vector(nseg+2)
      
      x_comp.interpolate(range, len_sect, x_sect)
      y_comp.interpolate(range, len_sect, y_sect)
      z_comp.interpolate(range, len_sect, z_sect)
      
      
                x_model.append(x_comp)
      y_model.append(y_comp)
      z_model.append(z_comp)
   }
// Write location information to files   
   f = new File("D:/NEURON/Model2/my model/coordinate/x_loca1.dat")
   f.wopen()
   x_model.vwrite(f)
   f.close()
   
   f = new File("D:/NEURON/Model2/my model/coordinate/y_loca1.dat")
   f.wopen()
   y_model.vwrite(f)
   f.close()
   
   f = new File("D:/NEURON/Model2/my model/coordinate/z_loca1.dat")
   f.wopen()
   z_model.vwrite(f)
   f.close()
}
     
          proc main(){
   GetSL()
   
   InitCell()
   
   FindLoca()

   }
main()

   quit()

however when i run the main file error happened:
nrniv: syntax error
in /cygdrive/D/home/Model2/my model/main.hoc near line 19
proc FindLoca() { local i,n localobj x_comp,y_comp,z_comp
i cant find the problem. do you have any advice?
thanks a lot.

Re: how to check where the error is

Posted: Thu Oct 07, 2010 12:36 pm
by ted
Only 1 localobj statement allowed in a proc. If you need to continue across multiple lines, change

Code: Select all

proc FindLoca() { local i,n      localobj x_comp,y_comp,z_comp
   localobj x_sect,y_sect,z_sect,len_sect,range
to

Code: Select all

proc FindLoca() { local i,n      localobj x_comp,y_comp,z_comp \
   x_sect,y_sect,z_sect,len_sect,range
Other errors may also be present, but this is probably the one that caused the error message.