Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: TableForm and MatrixForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53662] Re: TableForm and MatrixForm
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 22 Jan 2005 03:51:42 -0500 (EST)
  • References: <csntsc$4k0$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Blimbaum, Jerry AA R22 wrote:
> A recent question about outputting the following table as a 3 col matrix
> 
> Table[{Sin[x],Cos[y],Sin[x]*Cos[y]},{y,0,2},{x,0,3}];
> 
> gave 2 responses.....
> 
> Flatten[data,1]//MatrixForm
> 
> 
> Flatten[data,1]//TableForm
> 
> The output of these 2 is quite dissimilar....MatrixForm puts a
> parentheses around the table and centers the expressions on each
> line....whereas TableForm doesn't output parentheses nor does it center
> the expressions on each line.....Is this intentional or an
> oversight?.....I dont like the parentheses but I dont like the
> expressions not centered on the column either....
> 
> 
> Jerry blimbaum
> 
> 
Hi,

I don't get centering with either form, but you can get what you want with:

GridBox[Map[ToBoxes[#] &, Flatten[data, 1], {2}]] // DisplayForm

The GridBox has all sorts of options, and you can nest StyleBox objects 
inside it so that you can output an array as a table with bold headings 
and lines as a grid, or just marking off the headings. If you are 
interested in the exact appearance of your output, this is definitely 
the way to do it.

David Bailey
dbaileyconsultancy.co.uk


  • Prev by Date: Monte Carlo Simulation Experiences
  • Next by Date: Re: TableForm and MatrixForm
  • Previous by thread: Re: TableForm and MatrixForm
  • Next by thread: Re: TableForm and MatrixForm