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

MathGroup Archive 2004

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

Search the Archive

What's wrong with this small code?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49928] What's wrong with this small code?
  • From: jianchaoyao at hotmail.com (Justin)
  • Date: Fri, 6 Aug 2004 03:09:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I made a 4*4 IdentityMatrix, named "test". Then, I wanna show the
diagnol "1" in RED. After running the following code, I got the red
diagnol opposite to the "1" diagnol. What's wrong with this code? Can
anybody find it out?

Thanks.  
 
test = IdentityMatrix[4];
{numRows, numColumns} = Dimensions[test];
Show[
  Graphics[
    RasterArray[
      Table[
        If[
          test[[i, j]] > 0,
          RGBColor[1, 0, 0],
          RGBColor[0, 1, 0]
          ],
        {i, 1, numRows}, {j, 1, numColumns}
        ]
      ]
    ]
  ]


  • Prev by Date: Re: How to creat this 8×8 images
  • Next by Date: Re: How to creat this 88 images
  • Previous by thread: Re: How to creat this 8×8 images
  • Next by thread: Re: What's wrong with this small code?