Page 1 of 1

using IF/ELSE statement

Posted: Tue Jun 24, 2014 9:52 pm
by sonyadave
Hi,

I'm trying to write a simple statement to limit my calcium current to -3 mA/cm2...what's wrong with my code?
Also, it was working perfectly fine until I added the last line (below the comment S.D. added....)
It is giving a syntax error at this line.
BREAKPOINT {
SOLVE states METHOD cnexp
A = getGHKexp(v)
icacalc = gcalbar * m*m*m * (4.47814e6 * v / T) * ((cai/1000) - (cao/1000) * A) / (1 - A) : S.D. changed ica to icacalc
: S.D. added the below to limit ica from cal to icarange.
if(icacalc < 3 && -1*icacalc < 3) ica = icacalc else ica=-3
}

Re: using IF/ELSE statement

Posted: Wed Jun 25, 2014 1:34 pm
by ted
Tinker with the conditional statement's syntax until you get it right. Suggest you implement one limit first, then when that's working, implement the other one. Short simple statements are easier to develop and debug than long statements that try to implement multiple comparisons and conditional outcomes.

Re: using IF/ELSE statement

Posted: Fri Jun 27, 2014 12:12 am
by ted
Additional tips: you might find some examples of conditional statements in chapter 9 of the NEURON Book. Also, take a look at this old reference for SCoP, whose syntax is closely related to that of NMODL--look under the topic heading "Conditional Sub-blocks"
http://www.neuron.yale.edu/ftp/ted/neur ... opman.html