Hello,
Is there a floor and ceil function in neuron?
I know that I can use int for floor function , but what about ceil? ( I can not do floor + 1 because sometimes I can get a int number)
I notice that in NMOD
http://www.neuron.yale.edu/neuron/stati ... lfunc.html
there are ceil and floor functions.
Thank You.
floor and ceil function
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: floor and ceil function
It's NMODL (NEURON Model Description Language).
A mod file with SUFFIX nothing can be used to add arbitrary functions written in NMODL or C to hoc. Create a mod file called dummy.mod and put the following statements in it:Put it in the directory that contains your hoc code that requires floor or ceil, then run mknrndll or nrnivmodl. hoc will now have two new functions called gfloor and gceil that allow execution of this statementto produce the following result:
A mod file with SUFFIX nothing can be used to add arbitrary functions written in NMODL or C to hoc. Create a mod file called dummy.mod and put the following statements in it:
Code: Select all
: dummy.mod
: Makes functions written in C or NMODL available to hoc
NEURON {
SUFFIX nothing
}
: call it gceil to avoid naming conflicts
FUNCTION gceil(z) {
gceil = ceil(z)
}
FUNCTION gfloor(z) {
gfloor = floor(z)
}
Code: Select all
print "floor(PI) = ", gfloor(PI), " ceil(PI) = ", gceil(PI)
Code: Select all
floor(PI) = 3 ceil(PI) = 4