MathGroup Archive 2004

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

Search the Archive

What's wrong with this small code?


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?