MathGroup Archive 2007

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

Search the Archive

Re: Grid


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