MathGroup Archive 2008

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

Search the Archive

Re: Conditional Table Formatting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90648] Re: [mg90612] Conditional Table Formatting
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Thu, 17 Jul 2008 05:36:45 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200807161028.GAA08720@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Here's one way.  (Undoubtedly there's a shorter, more elegant way to do 
this with pattern-matching.)

   data={{24,6,-6,0},{-6,-42,120,96},{-48,42,48,6}};

   bigRowEntryQ[row_]:=Or@@Thread[row>100]
   flagItem[x_]:=Style[x,FontColor->Red]

   Do[If[bigRowEntryQ[data[[i]]],data[[i]]=flagItem/@data[[i]]],{i,1,3}]

   data//TableForm

The items in row 2 will now be red.  Of course you would NOT now want to 
operate upon this table; for example, evaluating

   2 data

will give unwanted results.

Gregory Lypny wrote:
> Hello again,
> 
> Is there a way to make table formatting conditional the table's  
> values, for example, make a row red if the value in column 7 is bigger  
> than 100.
> 
> Regards,
> 
> 	Gregory
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Formatting Plot Legends
  • Next by Date: Re: Solve[] doesn't
  • Previous by thread: Conditional Table Formatting
  • Next by thread: Re: Conditional Table Formatting