Re: FormatType problems
- To: mathgroup at smc.vnet.net
 - Subject: [mg86618] Re: FormatType problems
 - From: dh <dh at metrohm.ch>
 - Date: Sat, 15 Mar 2008 03:10:12 -0500 (EST)
 - References: <frdftf$b0v$1@smc.vnet.net>
 
Hi,
you could e.g. use $PrePrint:
$PrePrint=(#/.{x_?NumberQ:>NumberForm[x,{6,2}]})&;
where we assumed you want to print at most 6 digits with 2 digits after 
the decimal points. You should only use this just before you print and 
then reset $Preprint like:
$PerPrint=.
otherwise you will see a lot of strange behaviour.
hope this helps, Daniel
alexxx.magni at gmail.com wrote:
> Hi guys,
> I have to output data to be read by other mathematica-agnostic
> programs - so I wanted to avoid exponential/scientific notation if
> possible.
> 
> I wrote:
> nf[x_] := NumberForm[N[x], Infinity, ExponentFunction -> (Null &)]
> 
> to convert my data, but I wanted to know if I could even avoid to
> write everywhere:
> Write[f,nf[a],nf[b],...]
> 
> and just let Math know that it has to use nf[] as a wrapper.
> Unfortunately,
> f = OpenWrite["test.dat",  FormatType -> nf]
> 
> doesnt work:
> FormatType::ftype: Value of option FormatType -> nf is not valid.
> 
> $printForms reports:
> {InputForm, OutputForm, TextForm, CForm, FortranForm, MathMLForm, \
> TeXForm, StandardForm, TraditionalForm}
> 
> any hint?
> 
> Alessandro Magni
> 
>