Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Grid

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80953] Re: [mg80908] Grid
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Thu, 6 Sep 2007 05:27:27 -0400 (EDT)
  • References: <200709050654.CAA26992@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?
>
>John
>
>  
>
One can use the optional third argument of SparseArray:

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

or

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

Carl Woll
Wolfram Research


  • References:
    • Grid
      • From: John <jwa0@lehigh.edu>
  • 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