Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*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 2003

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

Search the Archive

Re: Formatted output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39259] Re: Formatted output
  • From: "News Admin" <news at news.demon.net>
  • Date: Thu, 6 Feb 2003 03:08:07 -0500 (EST)
  • References: <b1q704$34m$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Steve,

CellPrint is more likely than Print to do what you want:

data=
    {{1.234,345.000006},{1.3,1.2}};

CellPrint[Cell[BoxData[GridBox[data, ColumnAlignments -> {Right},
GridFrame -> True,
     ColumnLines -> True, ColumnsEqual -> True]], "Text"]]

You will find the options for GridBox in the help browser.
They can be applied interactively to a selected displayed grid using the
Option Inspector

Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565




"Steve Gray" <stevebg at adelphia.net> wrote in message
news:b1q704$34m$1 at smc.vnet.net...
> Hello all,
>
> I want to produce a table of text output (in the same notebook
> my code is in). The output consists of many rows of numbers, each row
> containing the same number of numbers. For example the entire output
> might consist of 500 rows each having 7 columns. It is important for
> understanding the output to have well-formatted columns of a constant
> width regardless of the number of digits in each number (which will be
> no more than say 9). In the columns the numbers should be
> right-aligned.
> "Print" does not seem to have enough control to do this. It's
> much less flexible than the print statement in C. What I need is
> something like that. I've been reading the book, sections 2.7, 2.8,
> etc., and it looks like I will have to write an actual (small) program
> to do this.
> I'd appreciate any suggestions or leads to a package where all
> this is already done.
> Many thanks.
>
> Steve Gray
>
>




  • Prev by Date: Can matrix inversion mod N be automated?
  • Next by Date: Re: Formatted output
  • Previous by thread: Re: Formatted output
  • Next by thread: Re: Formatted output