MathGroup Archive 2007

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

Search the Archive

Re: Grid

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80931] Re: Grid
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 6 Sep 2007 05:16:11 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fblk36$qic$1@smc.vnet.net>

John wrote:
> I want to create a 9x9 grid that has specified positive integers,
> fewer than 81, entered in specified cells. I used SparseArray to enter
> the specified numbers in the specified cells, but it put a 0 in every
> unspecified cell.How do I convert the zeros to blanks?

The default value can be specified in the third arguments of SparseArray 
(the second argument, in this case, being the size of the array or 
Automatic). For instance,

sp = SparseArray[{{2, 2} -> 9, {3, 4} -> 81}, {5, 5}, " "]
Grid[sp, Frame -> All]

-- 
Jean-Marc


  • Prev by Date: Re: Problem in Solving Double Integral for PDF transformation
  • Next by Date: question on Max and Min
  • Previous by thread: Re: Grid
  • Next by thread: Re: Grid