print with format

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

print with format

Luis Isaac Ramos Garcia
  Dear liters;

   When using the print function to save some numeric data to a file, is
it possible to save those numbers with some numeric format; for example
if I would like to save the sin(3.5)=-0.350783227, but only three
significant digits sin(3.5)=-0.351; Is there any way do this in macro
language.

    Thanks in advance,

--
Dr Luis Isaac Ramos Garcia
Departamento de Oncologia
Clinica Universidad de Navarra
Facultad de Medicina,Universidad de Navarra
Av. Pio XII nº36, 31008 Pamplona, Spain
Fax: +34 948255500
TEL: +34 948255400 (Ext. 4924)
E-mail: [hidden email]
Web Page: http://www.cun.es
Reply | Threaded
Open this post in threaded view
|

Re: print with format

BenTupper
On Jul 23, 2010, at 5:36 AM, Luis Isaac Ramos Garcia wrote:

> Dear liters;
>
>  When using the print function to save some numeric data to a file,  
> is it possible to save those numbers with some numeric format; for  
> example
> if I would like to save the sin(3.5)=-0.350783227, but only three  
> significant digits sin(3.5)=-0.351; Is there any way do this in  
> macro language.
>

Hi,

You can get some control over the format using the d2s() macro  
function.  See http://rsb.info.nih.gov/ij/developer/macro/functions.html#D

//sin(3.5)=-0.350783227
print(d2s(sin(3.5), -10));

Cheers,
Ben




>   Thanks in advance,
>
> --
> Dr Luis Isaac Ramos Garcia
> Departamento de Oncologia
> Clinica Universidad de Navarra
> Facultad de Medicina,Universidad de Navarra
> Av. Pio XII nº36, 31008 Pamplona, Spain
> Fax: +34 948255500
> TEL: +34 948255400 (Ext. 4924)
> E-mail: [hidden email]
> Web Page: http://www.cun.es
Reply | Threaded
Open this post in threaded view
|

Re: print with format

dscho
In reply to this post by Luis Isaac Ramos Garcia
On Fri, 23 Jul 2010, Luis Isaac Ramos Garcia wrote:

>  Dear liters;

Dear cubic meter,

>   When using the print function to save some numeric data to a file, is
> it possible to save those numbers with some numeric format; for example
> if I would like to save the sin(3.5)=-0.350783227, but only three
> significant digits sin(3.5)=-0.351; Is there any way do this in macro
> language.

See the d2s() function:
http://rsb.info.nih.gov/ij/developer/macro/functions.html#D

Ciao,
Johannes