Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12798

Re: silly question on formatting tables

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: silly question on formatting tables
Date 2012-12-15 10:48 +0000
Message-ID <kahkh2$d7i$1@smc.vnet.net> (permalink)
References <20121214080121.1B6FF694F@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


data = {{0, 0, 1.19092}, {0.883038, 0, 0.366804},
   {0, 0, 0}};

(dataFormatted = data /.
    x_Real :> NumberForm[x, {4, 2}]) //
 Grid

dataFormatted // TableForm

dataFormatted // MatrixForm


Bob Hanlon


On Fri, Dec 14, 2012 at 3:01 AM,  <alba.maydeu@gmail.com> wrote:
> Dear all,
>
> Consider the matrix
>
> {{0, 0, 1.19092}, {0.883038, 0, 0.366804}, {0, 0, 0}}
>
> How can I display it in matrixform/tableform so that the integers are displayed as integers and the reals are displayed only with 2 decimals?
>
> If I use MatrixForm, the reals are displayed with 6 decimals, and if I use TableForm all numbers, including integers are displayed with 2 decimals.
>
> Thanks!
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: silly question on formatting tables Bob Hanlon <hanlonr357@gmail.com> - 2012-12-15 10:48 +0000

csiph-web