MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Formating with TableForm


Hi Jeffry,

if you want to format every column differently, you can format every 
element separately. Here is an example:
Some data:
d = Table[Random[], {3}, {3}];
Here the "columns to be" must be in rows. Therefore, eventually Transpose.
We now format every row differently by e.g. row-1 2 digits, row-2 3 
digits ...
d = MapThread[#1 /@ #2 &, {{
       NumberForm[#, 2] &, NumberForm[#, 3] &, NumberForm[#, 4] &}, d}];
Now we transpose and print it:
TableForm[ Transpose[d] ]

Sincerely, Daniel

Jeffrey Pattavina wrote:

 >Thanks very much for the tip. I have the follow up question.
 >
 >Q;	If I must use NumberForm[TableForm[t], 3] as you suggest, then how
 >can I format data (columns) in a table differently. For example, one 
column
 >could be percents so you might want to use NumberForm[#,{10,2}]while 
another
 >column might be long numbers which you would want in scinetific form or
 >NumberForm[#,{10,0},DigitBlock->3].
 >
 >


  • Prev by Date: Re: Trouble with an integral
  • Next by Date: Re: How to get decent quality plots.
  • Previous by thread: Re: Formating with TableForm
  • Next by thread: FindFit with conditionals