Re: Formating with TableForm
- To: mathgroup at smc.vnet.net
- Subject: [mg57413] Re: Formating with TableForm
- From: dh <dh at metrohm.ch>
- Date: Fri, 27 May 2005 04:56:49 -0400 (EDT)
- References: <d6us9e$j1c$1@smc.vnet.net> <d742sp$iqg$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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].
>
>