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?
One can use the optional third argument of SparseArray:

SparseArray[RandomInteger[{1, 9}, {30, 2}] -> 1, Automatic, ""] // Normal


SparseArray[RandomInteger[{1,9}, {30,2}] -> 1, {9,9}, ""] //Normal

Carl Woll
Wolfram Research

  • Prev by Date: Re: strange rounding result
  • Next by Date: Re: Problem in Solving Double Integral for PDF transformation
  • Previous by thread: Re: Grid
  • Next by thread: Re: Grid