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


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

Re: silly question on formatting tables

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-12-15 10:48 +0000
Last post2012-12-15 10:48 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#12798 — Re: silly question on formatting tables

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-12-15 10:48 +0000
SubjectRe: silly question on formatting tables
Message-ID<kahkh2$d7i$1@smc.vnet.net>
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!
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web