Print more decimal places

Anything that doesn't fit elsewhere.
Post Reply
Posts: 23
Joined: Tue Jul 08, 2014 1:31 pm

Print more decimal places

Post by afc »

Dear NEURON users!!

I am using the impedande class to compute the electrotonic distance of some dendrites. To achieve this I used a slightly modified code from The code I am using is the following:

Code: Select all

// prepare to use Impedance class

// always a good idea to finitialize before computing impedance

// demonstrate use of impedance class

objref zz
zz = new Impedance()

FREQ = 0 // Hz
WHERE = 0.5 // location in the soma that is the reference point

soma distance(0, WHERE)  // sets origin for distance calculations

proc calcZ() {
  soma zz.loc(WHERE)  // sets origin for impedance calculations
  zz.compute(FREQ, 1) // takes the impedance contributions of 
                      // gating state differential equations into account
                      // but requires mechanisms to be compatible with CVODE

  print "distance(x) ratio(x)"
  forall {
    print secname()
    for (x) if (x==1) print x3d(x), y3d(x), z3d(x), log(1/(zz.ratio(x)))

The neurons are imported to NEURON from a swc. file, and for what i intend to do next, i need to print the xyz coordinates to maximum precision as possible, i.e. with as many decimal places as possible, ideally as many as in the swc. file. Otherwise, I will get some xyz replicates and that really complicates what i want to do next!

Any ideas on how I can print more decimal places??

Thank you all in advance

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

Re: Print more decimal places

Post by ted »

Use printf with format strings that specify how numbers are to be printed. This is documented in the Programmer's Reference; you may also want to examine a standard text on C for more examples. It is a good idea to verify your understanding by running a few tests at the oc> prompt, e.g.
oc>printf("%f\n", PI)
and seeing exactly what is printed.

Post Reply