Printf statments

Moderator: wwlytton

Post Reply
Krishna Chaitanya
Posts: 70
Joined: Wed Jan 18, 2012 12:25 am
Location: University of Pavia

Printf statments

Post by Krishna Chaitanya » Wed Feb 15, 2012 7:59 pm

Hi Ted,

Is it not possible to use printf statements inside BREAKPOINT and FUNCTION blocks defined inside mod file?. It becomes very difficult to debug if these statements cannot be used. Is there any other way to do this? Thank you.

ted
Site Admin
Posts: 5619
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Printf statments

Post by ted » Thu Feb 16, 2012 9:39 am

printf statements can indeed be very useful for debugging NMODL source code. The syntax is identical to that used by C. Variable names should be as they are known inside the NMODL source code (no suffix or dot notation). For example

Code: Select all

NEURON {
  POINT_PROCESS PRtest
  RANGE index
}
ASSIGNED {
  v (mV)
}
PARAMETER {
  index = 0
}
BREAKPOINT {
  printf("BREAKPOINT\t index %d\t, t %g,\t v %g\n", index, t, v)
}
AFTER BREAKPOINT {
  printf("AFTER BREAKPOINT\t index %d\t, t %g,\t v %g\n", index, t, v)
}

Post Reply