using IF/ELSE statement

The basics of how to develop, test, and use models.
Post Reply
sonyadave

using IF/ELSE statement

Post 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
}
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: using IF/ELSE statement

Post 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.
ted
Site Admin
Posts: 5784
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: using IF/ELSE statement

Post 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
Post Reply